Sub Trier()
Dim source As Range, dest As Range, c As Range, n&, ncol%, nlig&, j%, i&, nn&
Set source = [A1:D29] 'modifiable
Set dest = [F3] 'modifiable
Application.ScreenUpdating = False
dest.CurrentRegion.Clear 'RAZ
For Each c In source
If c <> "" Then n = n + 1: c.Copy dest(n)
Next c
If n = 0 Then Exit Sub
dest.Resize(n).Sort dest, xlAscending, Header:=xlNo 'tri
ncol = source.Columns.Count
nlig = Application.RoundUp(n / ncol, 0)
For j = 1 To ncol
For i = 1 To nlig
nn = nn + 1
If j > 1 Then dest(nn).Copy dest(i, j)
If nn = n Then Exit For
Next i, j
If n > nlig Then dest.Offset(nlig).Resize(n - nlig).Clear 'effacement en bloc
End Sub
Sub Trier()
Dim source As Range, dest As Range, c As Range, n&, ncol%, nlig&, nn&
Set source = [A1:D29] 'modifiable
Set dest = [F3] 'modifiable
Application.ScreenUpdating = False
dest.CurrentRegion.Clear 'RAZ
For Each c In source
If c <> "" Then n = n + 1: c.Copy dest(n)
Next c
If n = 0 Then Exit Sub
dest.Resize(n).Sort dest, xlAscending, Header:=xlNo 'tri
ncol = source.Columns.Count
nlig = Application.RoundUp(n / ncol, 0)
For Each c In dest.Resize(nlig, ncol)
nn = nn + 1
dest(nn).Copy c
If nn = n Then Exit For
Next c
If n > nlig Then dest.Offset(nlig).Resize(n - nlig).Clear 'effacement en bloc
End Sub
Sub Tri()
Const source = "a3", nbrCol = 4, Cible = "f3"
Dim t, i&, j&, k&, n&, nlig&
Application.ScreenUpdating = False
i = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count
t = Range(source).Resize(i, 4)
ReDim lesVal(1 To UBound(t) * UBound(t, 2)): ReDim lesAdr(1 To UBound(t) * UBound(t, 2))
For i = 1 To UBound(t): For j = 1 To UBound(t, 2)
If t(i, j) <> "" Then n = n + 1: lesVal(n) = t(i, j): lesAdr(n) = Range(source)(i, j).Address(0, 0)
Next j, i
QuickSort lesVal, 1, n, lesAdr
nlig = Int(n / nbrCol): If nbrCol * nlig < n Then nlig = nlig + 1
Range(Range(Cible), Range(Cible).End(xlDown)).Resize(, nbrCol).Clear
For i = 1 To n
Range(lesAdr(i)).Copy Range(Cible).Cells(1 + ((i - 1) Mod nlig), 1 + Int((i - 1) / nlig))
Next i
End Sub
Sub QuickSort(a, gauc, droi, aa) ' d'après Jacques Boisgontier
' Voir le code dans le classeur joint...
End Sub
Sub Trier()
Dim source As Range, dest As Range, c As Range, n&, ncol%, nlig&, j%, i&, nn&
Set source = [A1:D29] 'modifiable
Set dest = [F3] 'modifiable
Application.ScreenUpdating = False
dest.CurrentRegion.Clear 'RAZ
For Each c In source
If c <> "" Then n = n + 1: dest(n) = "=" & c.Address 'formule de liaison
Next c
If n = 0 Then Exit Sub
dest.Resize(n).Sort dest, xlAscending, Header:=xlNo 'tri
ncol = source.Columns.Count
nlig = Application.RoundUp(n / ncol, 0)
For j = 1 To ncol
For i = 1 To nlig
nn = nn + 1
Range(Mid(dest(nn).Formula, 2)).Copy dest(i, j)
If nn = n Then Exit For
Next i, j
If n > nlig Then dest.Offset(nlig).Resize(n - nlig).Clear 'effacement en bloc
End Sub