1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Function SerchXls(Myrange As Range, MyCellule As Range, strRecherche, EntierCell As Boolean) As Long '
On Error Resume Next
SerchXls = 0
SerchXls = Myrange.Cells.Find(What:=strRecherche, After:=MyCellule, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=EntierCell).Row
If SerchXls <= MyCellule.Row Then SerchXls = 0
End Function
Sub scanner()
Dim scan As String
Dim ligne As Integer
Application.EnableEvents = False
scan = InputBox("saisir reference", "scan reference", "entrer reference")
If Trim("" & scan) <> "" Then
ligne = SerchXls(Columns("A:A"), Range("A1"), scan, True)
If ligne > 0 Then Rows(ligne).Select Else MsgBox "Pas trouvé", vbExclamation
Application.EnableEvents = True
End If
End Sub |
Partager