Bonjour faustine2005,
Voilà une macro qui utilise les fonctions Tri et Sous-totaux d'Excel :
Sub Tri_Totaux()
Dim Lignes As Long
Lignes = Range("A1").End(xlDown).Row
If Lignes > 65000 Then Lignes = 2
Range("A1:B" & Lignes).Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(2), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End Sub
S'il faut supprimer les sous-totaux par la suite :
Sub EnleveTotaux()
Range("A1").RemoveSubtotal
End Sub