VBA Code:
Sub TotalSum4() 'Add total sum to last row in column'
Dim r As Range: Set r = Cells(Rows.count, "M").End(xlUp)(2)
r = "Totals"
r(1, 2).Resize(, 1).FormulaR1C1 = "=SUM(R[-" & r.Row - 2 & "]C:R[-1]C)"
End Sub
This works for column M above, but i am trying to use this for a range below now for columns N to Z. I can not get it to work.
VBA Code:
Sub TotalSum5() 'Add total sum to last row in column'
Dim r As Range: Set r = Cells(Rows.count, [COLOR=rgb(184, 49, 47)]"N:Z")[/COLOR].End(xlUp)(2) '<--- need help to get this to work'
r = "Totals"
r(1, 2).Resize(, 1).FormulaR1C1 = "=SUM(R[-" & r.Row - 2 & "]C:R[-1]C)"
End Sub