H
Herman Merman
I want to get a macro to auto sum a variable range of numbers in a column:
I have found the following code for this from www.info-tat.com/XLVBA.htm
vRowTop = 5
vRowBottom = ActiveCell.Offset(-1, 0).Row
vDiff = -vRowBottom - vRowTop + 1
Selection.FormulaR1C1="=SUM(R["& -vDiff& "]C:R[-1]C)"
End Sub
The last line produces a compile error "Expected End of Statement" which I
can't figure out, I suspect it's something to do with the brackets or
quotations used.
Anybody know what's wrong with this code or have a better piece of code that
will auto sum a column?
Thanks
I have found the following code for this from www.info-tat.com/XLVBA.htm
vRowTop = 5
vRowBottom = ActiveCell.Offset(-1, 0).Row
vDiff = -vRowBottom - vRowTop + 1
Selection.FormulaR1C1="=SUM(R["& -vDiff& "]C:R[-1]C)"
End Sub
The last line produces a compile error "Expected End of Statement" which I
can't figure out, I suspect it's something to do with the brackets or
quotations used.
Anybody know what's wrong with this code or have a better piece of code that
will auto sum a column?
Thanks