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 43 44 45 46 47 48
| Private Sub TextBox1_Change()
Dim i As Long
Me.TextBox1 = Format(StrConv(Me.TextBox1, vbLowerCase))
Me.ListBox1.Clear
Me.ListBox1.AddItem "COL1"
Me.ListBox1.List(0, 1) = "COL2"
Me.ListBox1.List(0, 2) = "COL3"
Me.ListBox1.List(0, 3) = "COL4"
Me.ListBox1.List(0, 4) = "COL5"
Me.ListBox1.List(0, 5) = "COL6"
Me.ListBox1.List(0, 6) = "COL6"
Me.ListBox1.List(0, 7) = "COL7"
Me.ListBox1.List(0, 8) = "COL8"
Me.ListBox1.List(0, 9) = "COL9"
Me.ListBox1.List(0, 10) = "COL10"
Me.ListBox1.List(0, 11) = "COL11"
ListBox1.ColumnCount = 12
Me.ListBox1.Selected(0) = True
With Sheets("Opérations")
For i = 2 To .Range("B20000").End(xlUp).Row
For x = 1 To Len(.Cells(i, 1))
a = Me.TextBox1.TextLength
If LCase(Mid(.Cells(i, 1), x, a)) = Me.TextBox1 And TextBox1 <> "" Then
Me.ListBox1.AddItem .Cells(i, 1)
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(i, 2)
Me.ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(i, 3)
Me.ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(i, 4)
Me.ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(i, 5)
Me.ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(i, 6)
Me.ListBox1.List(ListBox1.ListCount - 1, 6) = .Cells(i, 7)
Me.ListBox1.List(ListBox1.ListCount - 1, 7) = .Cells(i, 8)
Me.ListBox1.List(ListBox1.ListCount - 1, 8) = .Cells(i, 9)
Me.ListBox1.List(ListBox1.ListCount - 1, 9) = .Cells(i, 10)
Me.ListBox1.List(ListBox1.ListCount - 1, 10) = .Cells(i, 11)
Me.ListBox1.List(ListBox1.ListCount - 1, 11) = .Cells(i, 12)
End If
Next x
Next i
End With
End Sub |
Partager