Re : Créer une liste avec une plage de cellules.
bonjour hulk
code
Private Sub UserForm_Initialize()
Dim c As Range, i As Long, j As Long, temp As String
For Each c In Range("A1:f" & Range("A65536").End(xlUp).Row) ' a adapter
cbx1 = c
If cbx1.ListIndex = -1 And cbx1 <> "" Then cbx1.AddItem c
Next c
For i = 0 To cbx1.ListCount - 1
For j = 0 To cbx1.ListCount - 1
If cbx1.List(i) < cbx1.List(j) Then
temp = cbx1.List(i)
cbx1.List(i) = cbx1.List(j)
cbx1.List(j) = temp
End If: Next j: Next i
End Sub
ma combobox se nomme cbx1
ps si tu veus les doublons tu ecris comme cela!!!
Private Sub UserForm_Initialize()
Dim c As Range, i As Long, j As Long, temp As String
For Each c In Range("A1:f" & Range("A65536").End(xlUp).Row) ' a adapter
cbx1 = c
If cbx1 <> "" Then cbx1.AddItem c
Next c
For i = 0 To cbx1.ListCount - 1
For j = 0 To cbx1.ListCount - 1
If cbx1.List(i) < cbx1.List(j) Then
temp = cbx1.List(i)
cbx1.List(i) = cbx1.List(j)
cbx1.List(j) = temp
End If: Next j: Next i
End Sub