Dim t1(), t(), x As Long, k As Long, i As Long, c
Private Sub UserForm_Initialize()
t = Feuil1.Range("a2:j" & Feuil1.Cells(Rows.Count, 1).End(3).Row)
For i = 1 To UBound(t)
If t(i, 9) <> "" Then
x = x + 1
t(i, 6) = t(i, 10)
ReDim Preserve t1(1 To 6, 1 To x)
For k = 1 To 6
t1(k, x) = t(i, k)
Next k: End If: Next i
ListBox1.Column = t1
c = ListBox1.List
Call Tri(c, 5, LBound(c), UBound(c))
ListBox1.List = c
End Sub
Sub Tri(a, ColTri, gauc, droi) ''Quick sort
ref = a((gauc + droi) \ 2, ColTri)
g = gauc: d = droi
Do
Do While a(g, ColTri) > ref: g = g + 1: Loop
Do While ref > a(d, ColTri): d = d - 1: Loop
If g <= d Then
For k = LBound(a, 2) To UBound(a, 2)
temp = a(g, k): a(g, k) = a(d, k): a(d, k) = temp
Next k
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call Tri(a, ColTri, g, droi)
If gauc < d Then Call Tri(a, ColTri, gauc, d)
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub