-->

What does “=R[-115]C” mean in VBA for Excel 2011 o

2019-07-02 02:03发布

问题:

What does "=R[-115]C" mean in VBA for Excel 2011 on Mac in below code?

Range("F171").Select    'to select a cell
ActiveCell.FormulaR1C1 = "=R[-115]C"

回答1:

It's the offset from the cell that the formula is in. The example you posted...

"=R[-115]C"

...would be offset by -115 rows in the same column, so would be equivalent to =F56.

You can do the same thing with the columns. This...

Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[1]"

...would give you the formula =B1.