I did some research and got the feeling its a rather simple question..
i want to sum a variable range: in my sheet, L25 can run to infinity, tricky part (for me), it shouldn't SUM till the last row-1 but last row -3 as there is a 'Totals' text above the place where the sum should be
so totals should be summed in L40, which in different cases can be another L row.
I think it's not that hard, but as I am a beginner, I think I make a elementary mistake. To show my effort, I managed to get this:
Sub Sumvariablerow
Range("L40").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-3]C)"
End Sub
Got the feeling it should be something like this:
Sub Sumvariablerow
Range("L40").Select
ActiveCell.FormulaR1C1 = "=SUM(L25:L" & R - 3 & ")"
End Sub
found the following topics: How to sum values in variable range in VBA?
VBA Summing a Column of Variable Length
thanks in advance
