Sub tableau()
Dim DerLigne As Long
Dim DerColonne As Integer, I As Integer, [COLOR=red]Tablo() as Long[/COLOR]
Application.ScreenUpdating = False
With Sheets("Synt_charge")
DerLigne = .[A65000].End(xlUp).Row 'dernière ligne de la feuille Synt_charge
DerColonne = .[IV2].End(xlToLeft).Column 'dernière colonne de la ligne 2 de la feuille Synt_charge
[COLOR=red]Redim Tablo(DerColonne - 4)[/COLOR]
[COLOR=red]For I = LBound(Tablo) to Ubound(Tablo)[/COLOR]
[COLOR=red]Tablo(I) = I + 4[/COLOR]
[COLOR=red]Next I[/COLOR]
End With
Sheets("Synt_charge").Activate
ActiveWindow.SmallScroll Down:=-14
Range(Cells(1, 1), Cells(DerLigne, DerColonne)).Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range( _
"B2"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase _ 'tri les colonnes a et b
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
Selection.Subtotal GroupBy:=1, Function:=xlSum, [COLOR=red]TotalList:=Tablo, _[/COLOR]
Replace:=False, PageBreaks:=False, SummaryBelowData:=True ' sous total en fonction de colonne a, des colonnes 4 jusqu'à la derniere
Selection.Subtotal GroupBy:=2, Function:=xlSum, [COLOR=red]TotalList:=Tablo[/COLOR], _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True ' sous total en fonction de colonne b, des colonnes 4 jusqu'à la derniere
ActiveSheet.Outline.ShowLevels RowLevels:=3
End Sub