Function MonTri(plage As Range, ordre As Long)
Dim c As Range, a(), n&
For Each c In plage
If c <> "" Then
ReDim Preserve a(n) 'base 0
a(n) = c
n = n + 1
End If
Next
If n = 0 Then MonTri = "": Exit Function
tri a, 0, n - 1
If ordre <= n Then MonTri = a(ordre - 1) Else MonTri = ""
End Function
Sub tri(a, gauc, droi) ' Quick sort
Dim ref, g, d, temp
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
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 Call tri(a, g, droi)
If gauc < d Then Call tri(a, gauc, d)
End Sub