How can I set the formula of an active cell using variables? I have a spreadsheet that I want to do a variety of totals on (inserting a row in the proper place and "Total" and then summing the variable number of prior rows).
For example, I want to sum the following:
B3:B7. The column will remain constant, but the startrow and endrow will vary. (I call them, as variables, "startrow" and "rowvar".)
I've tried things such as
ActiveCell.Formula="=SUM(Range(startrow & ':' & rowvar))"
OR
ActiveCell.FormulaR1C1="=SUM(R[offset]C:R[rowvar]C)"
I can't seem to get it. Does anyone know how to do this?
Thanks.
For example, I want to sum the following:
B3:B7. The column will remain constant, but the startrow and endrow will vary. (I call them, as variables, "startrow" and "rowvar".)
I've tried things such as
ActiveCell.Formula="=SUM(Range(startrow & ':' & rowvar))"
OR
ActiveCell.FormulaR1C1="=SUM(R[offset]C:R[rowvar]C)"
I can't seem to get it. Does anyone know how to do this?
Thanks.