marcdenney1
New Member
- Joined
- Sep 24, 2014
- Messages
- 42
Hi All,
I have a spreadsheet where the data starts in D3 but the end column is variable
I'm looking for some VBA to SUM everything in the row after the last column.
So far I have:
Its erroring on the SUM
Can anybody help?
Thanks
Marc
I have a spreadsheet where the data starts in D3 but the end column is variable
I'm looking for some VBA to SUM everything in the row after the last column.
So far I have:
Code:
Range("D2").Select
Selection.End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "Total"
ActiveCell.Offset(1, 0).Select
Dim LastColumn As Long
LastColumn = Range("XFD3").End(xlToLeft).Column + 1
Cells(LastColumn, 1).Formula = "=Sum(D3:3" & LastColumn - 1 & ")"
Its erroring on the SUM
Can anybody help?
Thanks
Marc