Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a variable in a SUM command? 1

Status
Not open for further replies.

Dan01

Programmer
Jun 14, 2001
439
US
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"

Is there a way to build this where the -3 can be a variable?

Thanks, Dan.
 
At run-time, yes:

ActiveCell.FormulaR1C1 = "=SUM(R[-" & numRows & "]C:R[-1]C)"

but not after the fact.
Rob


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top