billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Good evening
A bit stumped on how to sum a range utilizing R1C1. My code is:
Thanks for any help.
Sub sumeverycolum()
Dim lastcolumn As Long
Dim lcol As Long
Dim lastrow As Long
lastcolumn = Cells.Find(what:="*", after:=Range("A1"), _
searchorder:=xlByColumns, searchdirection:=xlPrevious).Column
For lcol = 1 To lastcolumn
lastrow = Cells(Rows.Count, lcol).End(xlUp).Row
With Cells(lastrow + 1, lcol)
.FormulaR1C1 = "=Sum(R1C:R" & lastrow & "D)"
End With
Next
End Sub
A bit stumped on how to sum a range utilizing R1C1. My code is:
Thanks for any help.
Sub sumeverycolum()
Dim lastcolumn As Long
Dim lcol As Long
Dim lastrow As Long
lastcolumn = Cells.Find(what:="*", after:=Range("A1"), _
searchorder:=xlByColumns, searchdirection:=xlPrevious).Column
For lcol = 1 To lastcolumn
lastrow = Cells(Rows.Count, lcol).End(xlUp).Row
With Cells(lastrow + 1, lcol)
.FormulaR1C1 = "=Sum(R1C:R" & lastrow & "D)"
End With
Next
End Sub