Private Sub TextBox1_Change()
Dim Plage As Range, cell As Range
Dim Recherche As String, Adresse As String
Dim Ligne As Long, N As Long
Dim C As Range
ListCommandes.Clear
N = 0
Recherche = TextBox1.Value
Range("D2").Select
Ligne = Sheets("BDcom").Range("A" & "65536").End(xlUp).Row
Set Plage = Sheets("BDcom").Range("A2:" & "J" & Ligne)
With Plage
Set C = .Find(Recherche, , xlValues, xlPart)
If Not C Is Nothing Then
Adresse = C.Address
Do
' If UCase(Recherche) = UCase(Left(C, Len(Recherche))) Then
ListCommandes.AddItem
N = ListCommandes.ListCount - 1
ListCommandes.List(N, 0) = C
ListCommandes.List(N, 1) = C.Offset(0, -3)
ListCommandes.List(N, 2) = C.Offset(0, -2)
ListCommandes.List(N, 3) = C.Offset(0, -1)
ListCommandes.List(N, 4) = C.Offset(0, 1)
ListCommandes.List(N, 5) = C.Offset(0, 2)
ListCommandes.List(N, 6) = C.Offset(0, 3)
ListCommandes.List(N, 7) = C.Offset(0, 4)
' End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Adresse
End If
End With
End Sub
Private Sub UserForm_Initialize()
ListCommandes.ColumnCount = 8
ListCommandes.ColumnWidths = "150;50;50;200;50;40;40;130"
End Sub