Option Explicit
Sub trier()
Dim i As Long, j As Long, X As Long, Y As Long
Application.ScreenUpdating = False
X = 2
Y = 2
With Sheets("Feuil1")
For j = 3 To 65536
X = X + 1
Y = X
If .Cells(j, 1) = "" Then Exit Sub
For i = 3 To 65536
If .Cells(X, 1) = "" Then Exit Sub
If .Cells(X, 1) <> .Cells(X + 1, 1) Then
Exit For
Else
X = X + 1
End If
Next i
Range(.Cells(Y, 1), .Cells(X, 13)).Select
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range(.Cells(Y, 8), .Cells(X, 8)), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range(Cells(Y, 1), Cells(X, 13))
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next j
End With
Application.ScreenUpdating = True
End Sub