formularc notation help

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » FormulaR1C1 notation help

FormulaR1C1 notation help

resolvedResolved · 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?

Edited on Wed 21 Jan 2009, 13:50

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 courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Wrapping Text in a Cell in an Excel 2010 Workbook

When 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.

View all Excel hints and tips


Server loaded in 0.08 secs.