une possibilité serait d'ajouter en colonne E, la valeur de i
ensuite trier par la colonne E, et supprimer la colonne E
Sub Macro2()
Dim i As Long, LastRw As Long, y As Integer
LastRw = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRw Step 3
For y = 1 To 3
Cells(i, y + 1) = Cells(i + y - 1, 1)
Next y
Cells(i, y + 1) = i
Next i
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("E1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("B1:E31")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E:E").Delete Shift:=xlToLeft
Range("A1").Select
End Sub