Hi,
Does this help you?
Sub Automate_Sum()
Dim ws As Worksheet
Dim iLastColumn As Integer, iLastRow As Integer
For Each ws In ThisWorkbook.Worksheets
With ws
iLastRow = .Range("A" & .Rows.Count).End(xlUp).Row
iLastColumn = Application.WorksheetFunction.Match("Total SUM", .Rows(1))
.Cells(2, iLastColumn).Formula = "=SUM(C2:" & Cells(2, iLastColumn - 1).Address(0, 0) & ")"
.Cells(2, iLastColumn).AutoFill Destination:=Range(.Cells(2, iLastColumn), .Cells(iLastRow, iLastColumn))
End With
Next ws
End Sub
Bookmarks