Simple Coding question

Desu Nota from Columbus

Well-known Member
Joined
Mar 17, 2011
Messages
556
Can anyone please explain the R and C notation used in VB? I don't understand this:

Code:
Range("N2").Select     
ActiveCell.FormulaR1C1 = "=(RC[-5]+RC[-1])/3600"
My assumption is the the "R" is just the absolute reference marker, but I don't quite comprehend the C[+/-#] notation
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Desu Nota from Columbus,

I hope this helps.

Your code:

Code:
Range("N2").Select
ActiveCell.FormulaR1C1 = "=(RC[-5]+RC[-1])/3600"

'could also be written
Range("N2").FormulaR1C1 = "=(RC[-5]+RC[-1])/3600"

'Or
Range("N2").Formula = "=(I2+M2)/3600"


Puts the following formula into cell N2:
=(I2+M2)/3600

With N2 as the cell to accept the formula
=(RC[-5]+RC[-1])/3600

The active cell N2 formula =(I2+M2)/3600


=(RC[-5]+RC[-1])/3600

The:
(RC[-5]

says, from R (the active row = row 2) N2 offset C-5 is cell I2

The:
+RC[-1]

says, from R (the active row = row 2) N2 offset C-1 is cell M2
 
Upvote 0

Forum statistics

Threads
1,224,565
Messages
6,179,549
Members
452,927
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top