Enfin mes données "ville" et "région" sont stockées sous la forme : colonne A : toutes mes régions et colonnes B,C,D,... mes villes.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub ComboBox1_Click()
deb = ComboBox1.ListIndex + 2
fin = Worksheets("Feuil1").Cells(deb, Columns.Count).End(xlToLeft).Column
For i = 2 To fin
ListBox1.AddItem Worksheets("Feuil1").Cells(deb, fin).Value
Next
End Sub
Private Sub UserForm_Activate()
Dim derlig As Long
derlig = Worksheets("Feuil1").Range("A" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "Feuil1!A2:A" & derlig
End Sub
Private Sub ComboBox1_Click()
deb = ComboBox1.ListIndex + 2
fin = Worksheets("Feuil4").Cells(deb, Columns.Count).End(xlToLeft).Column
For i = 2 To fin
ListBox1.AddItem Worksheets("Feuil4").Cells(deb, fin).Value
Next
End Sub
Private Sub UserForm_Activate()
Dim derlig As Long
derlig = Worksheets("Feuil4").Range("A" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "Feuil4!A2:A" & derlig
End Sub
For i = 2 To fin
ListBox1.AddItem Worksheets("Feuil4").Cells(deb, i).Value
Next
Dim ligne1 As Integer
Private Sub ComboBox1_Click()
ListBox1.Clear
Dim deb As Integer, fin As Integer
deb = ComboBox1.ListIndex + ligne1
fin = Worksheets("Feuil2").Cells(deb, Columns.Count).End(xlToLeft).Column
If fin = 2 Then ' cas d'une seule ville
ListBox1.AddItem Cells(deb, ligne1)
Else
ListBox1.List() = Application.Transpose(Range(Cells(deb, ligne1), Cells(deb, fin)))
End If
End Sub
Private Sub UserForm_Activate()
Dim derlig As Long
ligne1 = 2 'ligne à laquelle commencent tes régions
derlig = Worksheets("Feuil2").Range("A" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "Feuil2!A" & ligne1 & ":A" & derlig
End Sub