Option Explicit
Option Compare Text
Dim Ws As Worksheet
Dim T1
Sub AlimenteListbox()
Dim j As variant, i As variant, Indice As variant, D As variant, T2()
Me.ListBox1.Clear
Indice = 1 ' Par défaut toujours 1 enregistrement
For j = 1 To UBound(T1)
If T1(j, 1) Like Me.textbox1 & "*" And T1(j, 2) Like Me.textbox2 & "*" And T1(j, 3) Like Me.textbox3 & "*" And T1(j, 4) Like Me.textbox4 & "*" Then
Indice = Indice + 1
ReDim Preserve T2(1 To 5, 1 To Indice)
For i = 1 To UBound(T1, 2)
T2(i, Indice) = T1(j, i)
Next i
For D = 1 To UBound(T1, 1)
Next D
End If
Next j
If Indice > 1 Then
Me.ListBox1.List = Application.Transpose(T2)
Me.ListBox1.RemoveItem 0 ' On supprime l'enregistrement par défaut
End If
End Sub
private sub textbox1_Change()
AlimenteListbox
End Sub
private sub textbox2_Change()
AlimenteListbox
End Sub
private sub textbox3_Change()
AlimenteListbox
End Sub
private sub textbox4_Change()
AlimenteListbox
End Sub
Private Sub UserForm_Initialize()
Dim j As Long, Gauche As Double, Temp As String, i As Integer
Dim Mondico As Object
Set Ws = Sheets("feuil4")
T1 = Ws.Range("A2:e" & Ws.Range("A" & Rows.Count).End(xlUp).Row)
For j = 1 To UBound(T1)
T1(j, UBound(T1, 2)) = j + 1
Next j
Gauche = Me.ListBox1.Left + 5
For i = 1 To 5
Next i
With Me.ListBox1
.List = T1
end witch
end sub