FormulaR1C1

newvbie

Board Regular
Joined
Mar 18, 2006
Messages
69
hi there. I got the following vba to insert a formular onto 30 sheets in specified ranges.

For k = 2 To 31
(when k=2)
Sheets(k).Range("F22").FormulaR1C1 = "='Info Sheet'!R[-20]C[38]"
Sheets(k).Range("F23").FormulaR1C1 = "='Info Sheet'!R[-21]C[39]"
Sheets(k).Range("F25").FormulaR1C1 = "='Info Sheet'!R[-23]C[40]"
Sheets(k).Range("F26").FormulaR1C1 = "='Info Sheet'!R[-24]C[41]"
Sheets(k).Range("F28").FormulaR1C1 = "='Info Sheet'!R[-26]C[42]"
Sheets(k).Range("F31").FormulaR1C1 = "='Info Sheet'!R[-29]C[43]"
Next

However, how can I make it to something like this so that the formular will refer to the cell of next row in sheet "Info Sheet" :
when k=3
Sheets(k).Range("F22").FormulaR1C1 = "='Info Sheet'!R[-19]C[38]"
Sheets(k).Range("F23").FormulaR1C1 = "='Info Sheet'!R[-20]C[39]"
Sheets(k).Range("F25").FormulaR1C1 = "='Info Sheet'!R[-22]C[40]"
Sheets(k).Range("F26").FormulaR1C1 = "='Info Sheet'!R[-23]C[41]"
Sheets(k).Range("F28").FormulaR1C1 = "='Info Sheet'!R[-25]C[42]"
Sheets(k).Range("F31").FormulaR1C1 = "='Info Sheet'!R[-28]C[43]"

Any advice, please
Thanks.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Do you need this to use R1C1 notation?

It might actually be easier to understand if it was in A1 notation.
 
Upvote 0
Hi there. I removed the R1C1 and revised the formula by adding a variable and it worked. Thanks. By the way, if I got 10 optionbuttons and want to reset their values to false (ie. unselected), can I use vba to turn them off using a loop or I have to "optionbutton1.value=false" for each one? Thanks
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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