Option Compare Text
Private Sub UserForm_Initialize()
Me.enreg = [client].Rows.Count + 1
Me.Id = Application.Max([client[id]]) + 1
Tbl = [client].Value
Tri Tbl, LBound(Tbl), UBound(Tbl), 2
Me.Recherche.List = Tbl
End Sub
Sub Tri(a, gauc, droi, colTri) ' 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 c = LBound(a, 2) To UBound(a, 2)
temp = a(g, c): a(g, c) = a(d, c): a(d, c) = temp
Next
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call Tri(a, g, droi, colTri)
If gauc < d Then Call Tri(a, gauc, d, colTri)
End Sub