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 35 36 37 38 39 40 41 42
| Sub recherche8()
On Error GoTo finerreur
Dim marecherche As String
Marecherche2 = Application.InputBox("Saisir le mot à rechercher", "Recherche", Type:=1 + 2) 'Type 1 et 2 Valeur numérique et chaine de caractère
Cells.Find(What:=Marecherche2, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
ActiveCell.Select
MsgBox "Mot trouvé", vbInformation, "Recherche d'un nombre" 'Message si la recherche abouti
Selection.Font.ColorIndex = 3 '3 correspond à la couleur rouge
Attente (2000)
Selection.Font.ColorIndex = 2 '2 correspond à la couleur blanche
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 2
Attente (2000)
Selection.Font.ColorIndex = 3
Attente (2000)
Selection.Font.ColorIndex = 1'1 correspond à la couleur noir
Attente (2000)
GoTo Fin
finerreur: 'Renvoi ici si la recherche est non trouvée
MsgBox "Mot non trouvé", vbInformation, "Recherche" 'Message si rien n'ai trouvé
Fin:
End Sub
Sub Attente(milisecond As Integer)
Dim Start, PauseTime
PauseTime = milisecond / 7200
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
End Sub |
Partager