Private Sub UserForm_Activate()
Dim nodupes As New Collection, a&, t, t2()
t = Range([B2], [B65536].End(xlUp)).Value
On Error Resume Next
For i = 1 To UBound(t)
nodupes.Add t(i, 1), CStr(t(i, 1))
'Debug.Print Err.Number
If Err.Number = 0 Then a = a + 1: ReDim Preserve t2(1 To a): t2(a) = t(i, 1)
Err.Clear
Next
On Error GoTo 0
ComboBox1.List = OrderedArray(t2)
End Sub
Function OrderedArray(a, Optional gauc = -1, Optional droi = -1, Optional sens As Long = 0) ' Quick sort
Dim ref, g&, d&, temp, X
droi = IIf(droi = -1, UBound(a), droi): gauc = IIf(gauc = -1, LBound(a), gauc)
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Select Case sens 'choix du sens
Case 0
' Pour un tri croissant
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
Case 1
' Pour un tri décroissant
Do While a(g) > ref: g = g + 1: Loop
Do While ref > a(d): d = d - 1: Loop
End Select
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 X = OrderedArray(a, g, droi, sens)
If gauc < d Then X = OrderedArray(a, gauc, d, sens)
OrderedArray = a
End Function