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

formularc notation help

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

FormulaR1C1 notation help

ResolvedVersion 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:

Sorting List Subtotals

If you find that you would prefer to show the items in a subtotalled list in a different order, eg ascending rather than descending, you can sort your list. To sort a subtotalled list, hide the detail rows and then sort the subtotal rows. When you sort a subtotalled list, the hidden detail rows are automatically moved with the subtotal rows.
IMPORTANT: If you do not hide the details rows before sorting a subtotalled list, your subtotals will be removed and all of the rows in your list will be reordered.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.