Option Explicit
Sub FindReplace()
Dim Cell As Range
Dim Recherche As String, Remplacement As String
Dim FirstAddress As String, Resultat As String
Dim Compteur As Integer
Dim Question As Byte
Recherche = InputBox('Indiquez la String à chercher')
With ActiveSheet.UsedRange
Set Cell = .Find(Recherche, LookIn:=xlValues, LookAt:=xlPart)
If Not Cell Is Nothing Then
FirstAddress = Cell.Address
Do
Resultat = Resultat & Cell.Address(0, 0) & vbCrLf
Compteur = Compteur + 1
Set Cell = .FindNext(Cell)
Loop While Not Cell Is Nothing And Not Cell.Address = FirstAddress
End If
End With
If Not Compteur = 0 Then
Question = MsgBox('La String ' & Recherche & ' a été trouvée ' & Compteur & _
' fois, dans les cellules :' & vbCrLf & Resultat & vbCrLf & _
'voulez-vous effectuer un remplacement ?', vbQuestion + vbYesNo)
If Question = vbYes Then
Remplacement = InputBox('Indiquez la String à Remplacer')
Cells.Replace What:=Recherche, Replacement:=Remplacement, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End If
Else
MsgBox 'La String ' & Recherche & ' n'a pas été trouvée !'
End If
End Sub