VBA: Liste déroulante
Résolu
TeddyGalere
Messages postés
75
Date d'inscription
Statut
Membre
Dernière intervention
-
TeddyGalere -
TeddyGalere -
A voir également:
- VBA: Liste déroulante
- Excel compter cellule couleur sans vba - Guide
- Mkdir vba ✓ - Forum VB / VBA
- Incompatibilité de type vba ✓ - Forum VB / VBA
- Erreur 13 incompatibilité de type VBA excel ✓ - Forum Excel
- Vba range avec variable ✓ - Forum VB / VBA
2 réponses
Bonjour
Ceci dvrait aller
Cdlmnt
Ceci dvrait aller
Private Sub UserForm_Initialize()
Dim Derlig As Byte, Cptr As Byte
With Sheets("recap")
'remplit le combo avec libellés existant
Derlig = .Range("D" & Rows.Count).End(xlUp).Row
For Cptr = 6 To Derlig
If .Cells(Cptr, "D") <> "" Then ComboBox_choix.AddItem .Cells(Cptr, "D")
Next
End With
End Sub
Cdlmnt
Bonjour,
Liste sans vides triée
http://boisgontierjacques.free.fr/pages_site/formulairelistetriee.htm#Dictionary
http://boisgontierjacques.free.fr/fichiers/Formulaire/FormListeTrieeVides.xls
Option Compare Text
Private Sub UserForm_Initialize()
Dim temp()
Set f = Sheets("BD")
Set MonDico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A2:A" & f.[A65000].End(xlUp).Row)
If c.Value <> "" Then MonDico.Item(c.Value) = c.Value
Next c
temp = MonDico.items
Call tri(temp, LBound(temp), UBound(temp))
Me.ComboBox1.List = temp
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
Boisgontier
Liste sans vides triée
http://boisgontierjacques.free.fr/pages_site/formulairelistetriee.htm#Dictionary
http://boisgontierjacques.free.fr/fichiers/Formulaire/FormListeTrieeVides.xls
Option Compare Text
Private Sub UserForm_Initialize()
Dim temp()
Set f = Sheets("BD")
Set MonDico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A2:A" & f.[A65000].End(xlUp).Row)
If c.Value <> "" Then MonDico.Item(c.Value) = c.Value
Next c
temp = MonDico.items
Call tri(temp, LBound(temp), UBound(temp))
Me.ComboBox1.List = temp
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
Boisgontier
Merci beaucoup...
Rapide et efficace ;)