Private Sub TextBox1_Change()
Dim Tablo()
Dim Nb As Integer
If TextBox1 = "" Then Exit Sub
With ListBox1
.Clear
.ColumnCount = 5 'Nombre de colonnes affichée dans la Listbox (4 colonnes + celle qui est cachée)
'.ColumnWidths = "-1;-1;-1;-1;-1;0"
For L = 1 To Cells(Rows.Count, 2).End(xlUp).Row
If Cells(L, 2) > 0 Then
If Cells(L, 6) Like "*" & TextBox1 & "*" Then
'la recherche, ici c'est la colonne F
Nb = Nb + 1
ReDim Preserve Tablo(1 To 6, 1 To Nb)
Tablo(1, Nb) = Cells(L, 2)
Tablo(2, Nb) = Cells(L, 6) & Space(100 - Len(Cells(L, 6)))
Tablo(5, Nb) = Format(Cells(L, 9), "0.00")
Tablo(4, Nb) = Cells(L, 8)
Tablo(3, Nb) = Format(Cells(L, 7), "0.00")
Tablo(6, Nb) = L 'Gestion ds numéros de colonnes (Absolument indispensable)
End If
End If
Next L
If Nb = 0 Then Exit Sub
If UBound(Tablo, 2) = 1 Then
.AddItem Tablo(1, 1)
.List(.ListCount - 1, 1) = Tablo(2, 1)
.List(.ListCount - 1, 2) = Tablo(3, 1)
.List(.ListCount - 1, 3) = Tablo(4, 1)
.List(.ListCount - 1, 4) = Tablo(5, 1)
.List(.ListCount - 1, 5) = Tablo(6, 1)
Else
.List() = Application.Transpose(Tablo)
End If
.BackColor = &H80FF80
End With
Dim Somme1 As Currency, Somme2 As Currency, i%
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.List(i, 2) <> "" Then Somme1 = Somme1 + CCur(Me.ListBox1.List(i, 2))
If Me.ListBox1.List(i, 4) <> "" Then Somme2 = Somme2 + CCur(Me.ListBox1.List(i, 4))
Next
Me.TextBox2 = Somme1
Me.TextBox3 = Somme2
End Sub