ComboBox
Résolu
ti_mouton
Messages postés
143
Date d'inscription
Statut
Membre
Dernière intervention
-
pijaku Messages postés 12263 Date d'inscription Statut Modérateur Dernière intervention -
pijaku Messages postés 12263 Date d'inscription Statut Modérateur Dernière intervention -
2 réponses
Bonjour,
Et si, avant de poser une nouvelle question, tu allais répondre à tes sujets en cours :
https://forums.commentcamarche.net/forum/affich-32119334-erreur-70-permission-refusee
Et si, avant de poser une nouvelle question, tu allais répondre à tes sujets en cours :
https://forums.commentcamarche.net/forum/affich-32119334-erreur-70-permission-refusee
ti_mouton
Messages postés
143
Date d'inscription
Statut
Membre
Dernière intervention
Excuses moi, je pensais t'avoir répondu mais visiblement j'ai du faire une fausse manip ou oublié de valider ma réponse...
Pas de souci.
C'est fait.
Pour te répondre donc aujourd'hui.
Quel est l'événement qui, jusqu'à maintenant, remplit ta ComboBox5?
L'événement ComboBox5_Click.
Or, aujourd'hui, tu souhaiterais qu'elle soit "pré-remplie" si elle n'a qu'un seul élément.
Il te faut trouver donc l'événement déclencheur de cela.
Par exemple, tu peut ajouter le remplissage de ta combobox5 dans l'événement Initialize de l'UserForm.
La globalité de ton code donné plus haut deviendrait donc :
A tester...
C'est fait.
Pour te répondre donc aujourd'hui.
Quel est l'événement qui, jusqu'à maintenant, remplit ta ComboBox5?
L'événement ComboBox5_Click.
Or, aujourd'hui, tu souhaiterais qu'elle soit "pré-remplie" si elle n'a qu'un seul élément.
Il te faut trouver donc l'événement déclencheur de cela.
Par exemple, tu peut ajouter le remplissage de ta combobox5 dans l'événement Initialize de l'UserForm.
La globalité de ton code donné plus haut deviendrait donc :
Private Sub Userform_Initialize() Set f = Sheets("BDD") Set mondico = CreateObject("Scripting.Dictionary") For Each C In f.Range("C3:C" & f.[A65000].End(xlUp).Row) mondico(C.Value) = "" Next C temp = mondico.keys Call Tri(temp, LBound(temp), UBound(temp)) Me.ComboBox3.List = temp Set mondico = CreateObject("Scripting.Dictionary") For Each C In f.Range("E3:E" & f.[A65000].End(xlUp).Row) mondico(C.Value) = "" Next C temp = mondico.keys Call Tri(temp, LBound(temp), UBound(temp)) Me.ComboBox5.List = temp If Me.ComboBox5.ListCount = 1 Then Me.ComboBox5.ListIndex = 0 End Sub Private Sub ComboBox3_click() Me.ComboBox4.Clear Set mondico = CreateObject("Scripting.Dictionary") For Each C In f.Range("C3:C" & f.[A65000].End(xlUp).Row) If C = Me.ComboBox3 Then mondico(C.Offset(, 1).Value) = "" Next C temp = mondico.keys Call Tri(temp, LBound(temp), UBound(temp)) Me.ComboBox4.List = temp If Me.ComboBox4.ListCount = 1 Then Me.ComboBox4.ListIndex = 0 End Sub Private Sub ComboBox5_Click() End Sub Sub Tri(a, gauc, droi) ' Quick sort ref = a((gauc + droi) \ 2) g = gauc: d = droi Do Do While a(g) < ref: g = g + 1: Loop Do While ref < a(d): d = d - 1: Loop If g <= d Then temp = a(g): a(g) = a(d): a(d) = temp g = g + 1: d = d - 1 End If Loop While g <= d If g < droi Then Call Tri(a, g, droi) If gauc < d Then Call Tri(a, gauc, d) End Sub
A tester...