Private Sub CommandButton1_Click()
Dim i&, t(), n&
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
ReDim Preserve t(n)
t(n) = ListBox1.List(i, 0)
n = n + 1
End If
Next
Range("C2:C" & Rows.Count).ClearContents 'RAZ
If n Then [C2].Resize(n) = Application.Transpose(t)
End Sub
Private Sub UserForm_Initialize()
Dim d As Object, c As Range, temp()
Set d = CreateObject("Scripting.Dictionary")
For Each c In [Liste]
d(c.Value) = ""
Next
temp = Application.Transpose(d.keys)
Call Tri(temp, 1, UBound(temp))
ListBox1.List = temp
End Sub
Sub Tri(a(), gauc, droi) ' Quick sort de Jacques Boisgontier
Dim ref, g, d, temp
ref = a((gauc + droi) \ 2, 1)
g = gauc: d = droi
Do
Do While a(g, 1) < ref: g = g + 1: Loop
Do While ref < a(d, 1): d = d - 1: Loop
If g <= d Then
temp = a(g, 1): a(g, 1) = a(d, 1): a(d, 1) = 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