1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Sub recherche()
Dim valeur, vt, rep
Dim Msg1, Style, Title, Response1
rep = Array("A2", "A3", "A4", "A5", "A6")
For i = 0 To 4
valeur = rep(i)
Title = "RECHERCHE de " & valeur
Range("H1").Select
On Error Resume Next
ActiveSheet.Cells.Find(What:=valeur, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
If rep(i) = "A2" Then ActiveCell = "S16"
If rep(i) = "A3" Then ActiveCell = "S1"
If rep(i) = "A4" Then ActiveCell = "S2"
If rep(i) = "A5" Then ActiveCell = "S3"
If rep(i) = "A6" Then ActiveCell = "S4"
Response1 = vbYes 'MsgBox(Msg1, Style, Title)
Do While Response1 = vbYes
Cells.FindNext(After:=ActiveCell).Activate '
If rep(i) = "A2" Then ActiveCell = "S16"
If rep(i) = "A3" Then ActiveCell = "S1"
If rep(i) = "A4" Then ActiveCell = "S2"
If rep(i) = "A5" Then ActiveCell = "S3"
If rep(i) = "A6" Then ActiveCell = "S4"
If ActiveCell.Column <> 8 Then Range("H1").End(xlDown).Select
vt = Application.Find(valeur, ActiveCell)
If vt = 2015 Then GoTo pass
Loop
pass:
Next
MsgBox "Fin : les valeurs sont changées"
Exit Sub
End Sub |
Partager