Listbox en fonction de combobox
Bonjour à tous,
Je fais un mini formulaire, voici ma base de donnée :Type véhicule |
Option Clim |
Pseudo |
Fiat Ducato 2,3L E5+E5b |
sans clim |
a200 |
Iveco Daily 2,3L E5+E5OBD |
sans clim |
a201 |
Iveco Daily GMK 2,3L E5B |
sans clim |
a202 |
Iveco Daily GMK 2,3L E5B |
avec clim |
a203 |
Iveco Daily GMK 3L E5+E6 |
sans clim |
a204 |
Iveco Daily GMK 3L E5+E6 |
avec clim |
a205 |
Dans mon formulaire il y a : combobox1 -> colonne " Type Véhicule "
combobox2 -> colonne "option clim"
textbox1 -> la case corespondate aux choix de la combobox
Par exemple si je prend : combobox1= Iveco Daily GMK 2,3L E5B
combobox2 = sans clim
alors textbox1 = a202
Voici ce que j'ai pour l'instant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Sub lancement_pseudo()
Dim i As Integer
Dim Cell As Range
With Sheets("base").Range("B3") 'Inserer colonne A dans combobox1
UserForm1.ComboBox1.RowSource = Range(.Cells, .End(xlDown)(1, 1)).Address(External:=True)
End With
For i = 1 To Sheets("base").Range("C65536").End(xlUp).Row
ComboBox2 = Sheets("base").Range("C" & i)
If ComboBox2 = -1 Then ComboBox2.AddItem Sheets("base").Range("C" & i)
Next i
For Each Cell In Worksheets("base").Range("c3:c24")
UserForm1.ComboBox2 = Cell
If UserForm1.ComboBox2.ListIndex = -1 Then _
UserForm1.ComboBox2.AddItem Cell
Next Cell
UserForm1.Show
End Sub |
Maintenant il n'y a plus qu'à coder la textbox mais je sèhe.