Option Compare Text 'la casse est ignorée
Sub Trier()
'se lance par le raccourci clavier Ctrl+T
Dim pas&, tablo, j%, i&, a(), n&, ub&, deb As Range
pas = 80
tablo = [A1].CurrentRegion.Resize(, 3) 'matrice, plus rapide
For j = 1 To 3
For i = 2 To UBound(tablo)
If tablo(i, j) <> "" And i <> 1 + pas * Int(i / pas) Then
ReDim Preserve a(n)
a(n) = tablo(i, j)
n = n + 1
End If
Next i, j
ub = UBound(a)
tri a, 0, ub
n = 0
'---restitutions---
Set deb = [A1]
While deb <> ""
tablo = deb.Resize(pas, 3)
For j = 1 To 3
For i = 2 To pas
If n <= ub Then tablo(i, j) = a(n) Else tablo(i, j) = ""
n = n + 1
Next i, j
deb.Resize(pas, 3) = tablo
Set deb = deb.Offset(pas) 'tableau suivant
Wend
End Sub
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