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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| Public f1 As Worksheet, f2 As Worksheet, dico As Object
Public derlig&, i&, col&, ComboBox1, ComboBox2, ComboBox3, ComboBox4, flag2, plage
Public Sub Init_Combo1() 'SÉLECTION DE LA VILLE
'On Error Resume Next
UserForm1.ComboBox1.Clear
Set dico = CreateObject("Scripting.Dictionary")
Set f2 = Sheets("Feuil1")
derlig = f1.Range("c" & Rows.Count).End(xlUp).Row
ComboBox1 = f1.Range("c2:v" & derlig).Value
For i = LBound(ComboBox1) To UBound(ComboBox1)
If ComboBox1(i, 1) = UserForm1.TextBox1.Text Then dico(ComboBox1(i, 2)) = ComboBox1(i, 2)
Next i
With UserForm1
.ComboBox1.List = dico.items
.ComboBox1.ListIndex = -1
End With
End Sub
Public Sub Init_Combo2()
Dim ln
flag2 = 1
' Combobox3.Clear
' Combobox4.Clear
flag2 = 0
dico.RemoveAll
'On va lister les voies dont on a choisi le type
For col = 3 To UBound(plage, 2) (cette ligne me donne erreur 13 imcompatbilité de type
If UCase(plage(ln, col)) Like UCase(ComboBox2) & "*" Then il me sert à afficher une sélection de type de voie en fonction de la ville
dico(plage(ln, col)) = "" ex si à la ville de brou il existe une rue, quartier
End If la sélection n'affichera que les noms existants)
Next col
ComboBox3.List = Application.Transpose(dico.keys)
End Sub
Public Sub Init_Combo3()
UserForm1.ComboBox3.Clear
Set dico = CreateObject("Scripting.Dictionary")
Set f1 = Sheets("Feuil1")
derlig = f1.Range("c" & Rows.Count).End(xlUp).Row
ComboBox3 = f1.Range("c2:v" & derlig).Value
For i = LBound(ComboBox3) To UBound(ComboBox3)
If ComboBox3(i, 3) = UserForm1.ComboBox2.Text Then dico(ComboBox3(i, 4)) = ComboBox3(i, 4)
Next i
With UserForm1
.ComboBox3.List = dico.items
.ComboBox3.ListIndex = -1
End With
End Sub
Public Sub Init_Combo4()
UserForm1.ComboBox4.Clear
Set dico = CreateObject("Scripting.Dictionary")
Set f1 = Sheets("Feuil1")
derlig = f1.Range("a" & Rows.Count).End(xlUp).Row
ComboBox4 = f1.Range("a2:v" & derlig).Value
For i = LBound(ComboBox4) To UBound(ComboBox4)
If ComboBox4(i, 4) = UserForm1.ComboBox3.Text Then dico(ComboBox2(i, 5)) = ComboBox2(i, 5)
Next i
With UserForm1
.ComboBox4.List = dico.items
.ComboBox4.ListIndex = -1
End With
End Sub |
Partager