Bonjour a tous,
j'ai une macro qui me donne m'aide a trouver une cellule a partir d'un mot clef. quand cette cellule est selectionné, elle est painte en rouge. J'aimerais cependant qu'elle me colorie toit la ligne. que doit je changer dans ma macro.
Private Sub CommandButton1_Click()
'
' Macro1 Macro
' Macro enregistrée le 26/05/2011 par cmi
'Private Sub mot a recherché_Click()
mot = InputBox("Mot à rechercher ? (mot simple)")
If mot = "" Then Exit Sub
For feuille = 1 To Sheets.Count
Sheets(feuille).Select
Set trouvé1 = Cells.Find(What:=mot)
If Not trouvé1 Is Nothing Then
With trouvé1
.Activate
.Select
.Interior.ColorIndex = 3
End With
étiq:
If MsgBox("Suivant ?", 4) = vbNo Then Exit Sub
Set trouvé2 = Cells.FindNext(After:=ActiveCell)
Set trouvé3 = Cells.FindPrevious(After:=ActiveCell)
Do While trouvé2 <> trouvé1
With trouvé1
.Select
.Font.ColorIndex = 0
End With
With trouvé3
.Select
.Font.ColorIndex = 0
End With
With trouvé2
.Activate
.Select
.Interior.ColorIndex = 3
End With
GoTo étiq
Loop
End If
Next feuille
MsgBox "PLUS DE RESUSLTAT"
End Sub
j'ai une macro qui me donne m'aide a trouver une cellule a partir d'un mot clef. quand cette cellule est selectionné, elle est painte en rouge. J'aimerais cependant qu'elle me colorie toit la ligne. que doit je changer dans ma macro.
Private Sub CommandButton1_Click()
'
' Macro1 Macro
' Macro enregistrée le 26/05/2011 par cmi
'Private Sub mot a recherché_Click()
mot = InputBox("Mot à rechercher ? (mot simple)")
If mot = "" Then Exit Sub
For feuille = 1 To Sheets.Count
Sheets(feuille).Select
Set trouvé1 = Cells.Find(What:=mot)
If Not trouvé1 Is Nothing Then
With trouvé1
.Activate
.Select
.Interior.ColorIndex = 3
End With
étiq:
If MsgBox("Suivant ?", 4) = vbNo Then Exit Sub
Set trouvé2 = Cells.FindNext(After:=ActiveCell)
Set trouvé3 = Cells.FindPrevious(After:=ActiveCell)
Do While trouvé2 <> trouvé1
With trouvé1
.Select
.Font.ColorIndex = 0
End With
With trouvé3
.Select
.Font.ColorIndex = 0
End With
With trouvé2
.Activate
.Select
.Interior.ColorIndex = 3
End With
GoTo étiq
Loop
End If
Next feuille
MsgBox "PLUS DE RESUSLTAT"
End Sub
Dernière édition: