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
| Private Sub TextBox1_Change()
Application.ScreenUpdating = False
Range("A7:A1000").Interior.ColorIndex = 0 'enlève la couleur lorsqu'on vide la recherche sur la colonne A
Range("B7:B1000").Interior.ColorIndex = 0
Range("C7:C1000").Interior.ColorIndex = 0
Range("D7:D1000").Interior.ColorIndex = 0
Range("E7:E1000").Interior.ColorIndex = 0
Range("F7:F1000").Interior.ColorIndex = 0
Range("G7:G1000").Interior.ColorIndex = 0
Range("H7:H1000").Interior.ColorIndex = 0
Range("I7:H1000").Interior.ColorIndex = 0
Range("J7:H1000").Interior.ColorIndex = 0
Range("K7:H1000").Interior.ColorIndex = 0
ListBox1.Clear
If TextBox1 <> "" Then 'Si la boite de recherche n'est pas vide
For ligne = 7 To 100 'champs où la recherche est faites
If Cells(ligne, 11) Like "*" & TextBox1 & "*" Then 'Si la cellule de la 1ère colonne correspond à la recherche
Cells(ligne, 1).Interior.ColorIndex = 8 'surligne la 1ère colonne de la ligne en vert
Cells(ligne, 2).Interior.ColorIndex = 8
Cells(ligne, 3).Interior.ColorIndex = 8
Cells(ligne, 4).Interior.ColorIndex = 8
Cells(ligne, 5).Interior.ColorIndex = 8
Cells(ligne, 6).Interior.ColorIndex = 8
Cells(ligne, 7).Interior.ColorIndex = 8
Cells(ligne, 8).Interior.ColorIndex = 8
Cells(ligne, 9).Interior.ColorIndex = 8
Cells(ligne, 10).Interior.ColorIndex = 8
Cells(ligne, 11).Interior.ColorIndex = 8
ListBox1.AddItem Cells(ligne, 1)
End If
Next
End If
End Sub |
Partager