Dim countTot As Long
Dim counter As Long
Dim strSearchString As String
Dim ws As Object
Dim foundCell As Variant
Dim loopAddr As Variant
Dim returnValue As String
strSearchString = InputBox(prompt:="Entrer le nom pour la recherche", Title:="New")
If strSearchString = "" Then Exit Sub
For Each ws In Worksheets
countTot = countTot + Application.CountIf(ws.UsedRange, "=" & strSearchString)
Next ws
If countTot = 0 Then
returnValue = MsgBox(" La client " & strSearchString & " n'est pas enregistrée ", vbOKOnly, " Message ")
GoTo fin2
Else
counter = 0
For Each ws In Worksheets
With ws
.Activate
Set foundCell = .Cells.Find(What:=strSearchString, LookIn:=xlValues, LookAt:=xlPart)
If Not foundCell Is Nothing Then
loopAddr = foundCell.Address
Do
counter = counter + 1
foundCell.Activate
If countTot = 1 Then
returnValue = MsgBox(" La client " & strSearchString & " est enregistrée 1 seule fois ", vbOKOnly, " Message ")
Exit Sub
End If
If counter = countTot Then
returnValue = MsgBox(" La client " & strSearchString & " sélectionnée est la dernière !", vbOKOnly, "Message")
Exit Sub
Else
returnValue = MsgBox(" Le client " & strSearchString & " est le " _
& counter & " sur " & countTot & " existants. " & _
vbLf & " Voulez vous aller au suivant ? ", vbYesNo, "Message")
If returnValue = vbNo Then GoTo fin
Set foundCell = .Cells.FindNext(After:=foundCell)
End If
Loop While Not foundCell Is Nothing And foundCell.Address <> loopAddr
End If
End With
Next ws
End If
fin:
fin2: