ExcelPupper
Board Regular
- Joined
- Mar 2, 2020
- Messages
- 112
- Office Version
- 2019
- Platform
- Windows
I am trying to put sum formula for last rows of columns L, M, N however I get error when I try to run the code below and I think it's caused by the placing of quotation marks?
VBA Code:
Sub TotalAmt()
Dim lr as String
lr = Sheets(6).Cells(Rows.Count, "D").End(xlUp).Row
Sheets(6).Range("L" & lr : "N" & lr).Formula = "=SUM(L8:L" & lr -1 & ")"
End Sub