How do I enter a defined variable into a FormulaR1C1 statement?

5 pts.
Tags:
FormulaR1C1
Microsoft Excel
Microsoft Excel formulas
I’ve defined the variable ‘Year’ as shown below, and I use it a number of times in my script. However, I’d like to use it in the “FormulaR1C1” command as well (shown below). How would I enter the syntax, so that it references my variable 'Year'? Currently I’ve manually entered the year, as ‘2009’. --------------------------------------- Sub Macro1() Dim EOM, CURRENT, Year As String EOM = Application.InputBox("Enter Report Month in YYMM format") Year = 20 & Left(EOM, 2) ActiveCell.FormulaR1C1 = "=sumif(2009!C[18],RC[-3],2009!C[-1])"

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: