1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Dim LigneTotal, colTotal As Variant
LigneTotal = Range("A65536").End(xlUp).Address
LigneTotal = Range(LigneTotal).Row
For col = 2 To ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Column
If Cells(4, col) = "2006" Or Cells(4, col) = "2007" Then 'le sous totaux ne se font que sur les colonnes "2006" et "2007"For Rw = 5 To LigneTotal - 1
If Cells(Rw, 1) Like "Total*" Then 'pour repérer la ligne où il faut mettre le résultat du ss totalFor LigneNonVide = 5 To LigneTotal - 1
If Not IsEmpty(Cells(LigneNonVide, 1)) Then
Cells(Rw, col) = Cells(Rw, col) + Cells(LigneNonVide, col).Value
End If
Next LigneNonVide
End If
Next Rw
End If
Next col |
Partager