Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the function of FormulaR1C1?

Tags:

excel

vba

I have been looking at FormulaR1C1 as a function, how does this exactly work? I understand what has been said all over the internet which is stands as Row 1 Column 1, but how do people actually make it work? What is the end result of using FormulaR1C1?

Also can it be changed to start at a specific point in a sheet, or it always going to be R1C1? So could it be FormulaR2C3?

like image 443
Matt Ridge Avatar asked Oct 31 '12 19:10

Matt Ridge


People also ask

What is formula R1C1 in Excel?

What is R1C1 Reference Style in Excel? R1C1 is the other type of reference style that you can use in Excel. Here, R refers to the Row and C refers to the column, so R1C1 would refer to the cell in the first row and first column. Similarly, R2C3 would refer to the cell in the second row and third column.

What is double function in VBA?

VBA Double is a kind of data type we assign to declare variables, which is an improved or longer version of the “Single” data type variable and is usually used to store longer decimal places.


1 Answers

FormulaR1C1 has the same behavior as Formula, only using R1C1 style annotation, instead of A1 annotation. In A1 annotation you would use:

Worksheets("Sheet1").Range("A5").Formula = "=A4+A10" 

In R1C1 you would use:

Worksheets("Sheet1").Range("A5").FormulaR1C1 = "=R4C1+R10C1" 

It doesn't act upon row 1 column 1, it acts upon the targeted cell or range. Column 1 is the same as column A, so R4C1 is the same as A4, R5C2 is B5, and so forth.

The command does not change names, the targeted cell changes. For your R2C3 (also known as C2) example :

Worksheets("Sheet1").Range("C2").FormulaR1C1 = "=your formula here" 
like image 189
user15741 Avatar answered Oct 06 '22 01:10

user15741