newatmacros
New Member
- Joined
- Jun 23, 2016
- Messages
- 18
Hi Everyone!
As my username suggests, I am very new at VBA with Excel; however, I am really trying to create macros that can be utilized whenever. The one I am working on is one for my data. Its purpose is to sum Row 5 cell all the way down to the last cell row of data in the specified column. I have successfully used this kind of macro for different formulas that have work great; however, for some reason I cannot get this one to work. The error keeps coming up in the italicized red row for the end of the expression. I know that it must be something really simple that I am just not catching.
Any help will be much appreciated!
Thank you!
Sub SumData()
Dim LastRow As Long
LastRow = Range(ColNum).End(xlDown).Row
For ColNum = 8 To 1000 Step 3
Range (Cells(1, ColNum).FormulaR1C1 = "=SUM(R5C:R[" & LastRow & "]C)"
Next ColNum
End Sub
As my username suggests, I am very new at VBA with Excel; however, I am really trying to create macros that can be utilized whenever. The one I am working on is one for my data. Its purpose is to sum Row 5 cell all the way down to the last cell row of data in the specified column. I have successfully used this kind of macro for different formulas that have work great; however, for some reason I cannot get this one to work. The error keeps coming up in the italicized red row for the end of the expression. I know that it must be something really simple that I am just not catching.
Any help will be much appreciated!
Thank you!
Sub SumData()
Dim LastRow As Long
LastRow = Range(ColNum).End(xlDown).Row
For ColNum = 8 To 1000 Step 3
Range (Cells(1, ColNum).FormulaR1C1 = "=SUM(R5C:R[" & LastRow & "]C)"
Next ColNum
End Sub