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
|
Option Compare Text
Private Sub ListBox1_Click()
TextBox1 = ListBox1.List(ListBox1.ListIndex)
ListBox1.Visible = False
End Sub
Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ListBox1.Clear 'Exemple 2 (ListBox)
If TextBox1 <> "" Then
ListBox1.Visible = True
For ligne = 2 To 200
If Cells(ligne, 1) Like "*" & TextBox1 & "*" Or Cells(ligne, 3) Like "*" & TextBox1 & "*" Or Cells(ligne, 4) Like "*" & TextBox1 & "*" Or Cells(ligne, 5) Like "*" & TextBox1 & "*" Or Cells(ligne, 6) Like "*" & TextBox1 & "*" Or Cells(ligne, 8) Like "*" & TextBox1 & "*" Then
ListBox1.AddItem Cells(ligne, 1) & " " & Cells(ligne, 3) & " " & Cells(ligne, 4) & " " & Cells(ligne, 5) & " " & Cells(ligne, 6) & " " & Cells(ligne, 8) 'Exemple 2 (ListBox)
End If
Next
Else
ListBox1.Visible = False
End If
End Sub |
Partager