1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Sub MacroSousTotal()
Application.ScreenUpdating = False
ActiveCell.Offset(0, 0).Select
ActiveWorkbook.Names.Add Name:="stt", RefersToR1C1:=ActiveCell
Range("AN1:BQ1").Select
Selection.Copy
Application.Goto Reference:="stt"
ActiveCell.Offset(0, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Ligne1 = ActiveCell.Row
Do
ActiveCell.Offset(-1, 0).Select
Loop Until (ActiveCell = "SOUS TOTAL") Or (ActiveCell = "DESIGNATION")
ActiveCell.Offset(1, 0).Select
Ligne2 = ActiveCell.Row
Application.Goto Reference:="stt"
ActiveCell.Offset(0, 8).Select
Range("J" & Ligne1).FormulaLocal = "=SOMME(J" & Ligne2 & ":J" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("K" & Ligne1).FormulaLocal = "=SOMME(K" & Ligne2 & ":K" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 4).Select
Range("N" & Ligne1).FormulaLocal = "=SOMME(N" & Ligne2 & ":N" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 9).Select
Range("W" & Ligne1).FormulaLocal = "=SOMME(W" & Ligne2 & ":W" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 2).Select
Range("Y" & Ligne1).FormulaLocal = "=SOMME(Y" & Ligne2 & ":Y" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("Z" & Ligne1).FormulaLocal = "=SOMME(Z" & Ligne2 & ":Z" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AA" & Ligne1).FormulaLocal = "=SOMME(AA" & Ligne2 & ":AA" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AB" & Ligne1).FormulaLocal = "=SOMME(AB" & Ligne2 & ":AB" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AC" & Ligne1).FormulaLocal = "=SOMME(AC" & Ligne2 & ":AC" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AD" & Ligne1).FormulaLocal = "=SOMME(AD" & Ligne2 & ":AD" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AE" & Ligne1).FormulaLocal = "=SOMME(AE" & Ligne2 & ":AE" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AF" & Ligne1).FormulaLocal = "=SOMME(AF" & Ligne2 & ":AF" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AG" & Ligne1).FormulaLocal = "=SOMME(AG" & Ligne2 & ":AG" & Ligne1 - 1 & ")"
ActiveCell.Offset(0, 1).Select
Range("AH" & Ligne1).FormulaLocal = "=SOMME(AH" & Ligne2 & ":AH" & Ligne1 - 1 & ")"
Application.Goto Reference:="stt"
Application.ScreenUpdating = True
End Sub |