Private Sub CommandButton1_Click()
Dim MotCherché As String, DerLig As Long, trouve As Boolean
Dim plage As Range, cel As Range, Adrdeb As String
Application.EnableEvents = False
Application.ScreenUpdating = False
If TextBox1.Value = "" Then Exit Sub
MotCherché = Me.TextBox1.Value
With Feuil1
DerLig = .Range("A" & .Rows.Count).End(xlUp).Row
Set plage = .Range("A5:A" & DerLig)
With plage
Set cel = .Find(MotCherché, after:=Feuil1.Range("A" & DerLig), LookAt:=xlPart)
If Not cel Is Nothing Then
trouve = True
Adrdeb = cel.Address
Do
Feuil1.Range(Feuil1.Cells(cel.Row, 1), Feuil1.Cells(cel.Row, 3)).Select
'pour visualiser la recherche
Feuil1.Range(Feuil1.Cells(cel.Row, 1), Feuil1.Cells(cel.Row, 3)).Interior.ColorIndex = 42
Set cel = .FindNext(cel)
Loop While Not cel Is Nothing And Adrdeb <> cel.Address
End If
End With
End With
If trouve = False Then MsgBox "Pas de trace du mot cherché !"
Unload Me
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub