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 49 50 51 52 53 54 55
|
Sub cherche()
Dim i As Long
Dim c As Long
Dim ColMarque As New Collection
Dim colModele As New Collection
Dim colCarburant As New Collection
If Marque.Text <> "" And Marque.Text <> strMarque Then
strMarque = Marque.Text
End If
If Modele.Text <> "" And Modele.Text <> strModele Then
strModele = Modele.Text
End If
If Carburant.Text <> "" And Carburant.Text <> strCarburant Then
strCarburant = Carburant.Text
End If
Marque.Clear
Modele.Clear
Carburant.Clear
i = 2
Do While ThisWorkbook.Worksheets("Feuil1").Range("A" & i).Value <> ""
On Error Resume Next
ColMarque.Add ThisWorkbook.Worksheets("Feuil1").Range("A" & i).Value, CStr(ThisWorkbook.Worksheets("Feuil1").Range("A" & i).Value)
If strMarque = "" Or ThisWorkbook.Worksheets("Feuil1").Range("A" & i).Value = strMarque Then
colModele.Add ThisWorkbook.Worksheets("Feuil1").Range("B" & i).Value, CStr(ThisWorkbook.Worksheets("Feuil1").Range("B" & i).Value)
End If
If strModele = "" Or ThisWorkbook.Worksheets("Feuil1").Range("B" & i).Value = strModele Then
colCarburant.Add ThisWorkbook.Worksheets("Feuil1").Range("C" & i).Value, CStr(ThisWorkbook.Worksheets("Feuil1").Range("C" & i).Value)
End If
i = i + 1
Loop
For c = 1 To ColMarque.Count
Marque.AddItem ColMarque(c)
Next c
For c = 1 To colModele.Count
Modele.AddItem colModele(c)
Next c
For c = 1 To colCarburant.Count
Carburant.AddItem colCarburant(c)
Next c
End Sub |