98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » FormulaR1C1 notation help
FormulaR1C1 notation help
Resolved · High Priority · Version 2007
Andrew has attended:
Excel VBA Intro Intermediate course
FormulaR1C1 notation help
Hi all,
I was wondering how in VBA where we have the FormulaR1C1 notation as:
activecell.FormulaR1C1 = "=SUM(RC[+1]:RC[+3])"
If how many rows/columns back I want to go is variable, how can I set the +1 and +3 values to some variable integer?
RE: FormulaR1C1 notation help
Hi Andrew
Thank you for your question regarding using FormuaR1C1.
The FormulaR1C1 property is a string so to use variables for the column offset in the formula you would need to add the different pieces of the string together using &.
Using your example and two integer variables iColOffset1 and iColOffset2 the code would change to
ActiveCell.FormulaR1C1 = "=SUM(RC[+" & iColOffset1 & "]:RC[+" & iColOffset2 & "])"
I hope that helps.
Please let me know how you get on.
Laura GB
Tue 27 Jan 2009: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Wrapping Text in a Cell in an Excel 2010 WorkbookWhen you have a lot of text you want to put in a particular cell but you can't decrease the font size to fit because the text will then become ineligible, then manually wrap the text in a cell by simply pressing ALT+ENTER. |