Recherche avec Find

FindPlusieurs.xls

Solution 1 (Avec gestion des erreurs)

Sub cherche()
   nomCherche = InputBox("Nom cherché? ")
   On Error Resume Next
   [A:A].Find(What:=nomCherche, LookIn:=xlValues, LookAt:=xlWhole).Select
   If Err <> 0 Then
      MsgBox "Pas trouvé"
   End If
   On Error GoTo 0
End Sub

Solution2

Sub cherche2()
   nomCherche = InputBox("Nom cherché? ")
   Set result = [A:A].Find(What:=nomCherche, LookIn:=xlValues, LookAt:=xlWhole)
   If result Is Nothing Then
      MsgBox "Non trouvé"
   Else
      result.Select
   End If
End Sub

Recherche de toutes les occurences

Sub cherche_plusieurs()
  nom = InputBox("Nom cherché?")
  Set champ = [A:A]
  champ.Interior.ColorIndex = xlNone
  Set c = champ.Find(nom, LookIn:=xlValues, LookAt:=xlWhole)
  If Not c Is Nothing Then
    premier = c.Address
    Do
      c.Interior.ColorIndex = 4
      Set c = champ.FindNext(c)
    Loop While Not c Is Nothing And c.Address <> premier
   End If
End Sub