Hi
I have two lastrow CUSTOMER & CLIENT .every time I will insert rows before lastrow contains CUSTOMER & CLIENT . what I want it sum the whole range before lastrow CUSTOMER & CLIENT and put the TOTAL in lastrow CUSTOMER & CLIENT for columns C,D,E should deal with new rows where insert before lastrow CUSTOMER & CLIENT.
this is what I try it but doesn't work so far .
Sub InsTots()
Dim totRow As Long
totRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(totRow, 2).Formula = "CUSTOMER"
Cells(totRow, 3).Formula = "=SUM(C2:C" & totRow - 1 & ")"
Cells(totRow, 4).Formula = "=SUM(D2:D" & totRow - 1 & ")"
Cells(totRow, 5).Formula = "=SUM(E2:E" & totRow - 1 & ")"
Cells(totRow, 2).Formula = "CLIENT"
Cells(totRow, 3).Formula = "=SUM(C2:C" & totRow - 1 & ")"
Cells(totRow, 4).Formula = "=SUM(D2:D" & totRow - 1 & ")"
Cells(totRow, 5).Formula = "=SUM(E2:E" & totRow - 1 & ")"
End Sub