Excel: Using Relative R1C1 References in MacrosID: Q46514
|
When you write a Microsoft Excel macro in R1C1 mode, relative
references to the worksheet refer to cells on the worksheet relative
to the cell containing the reference on the macro sheet. This behavior
is often encountered when using the FORMULA command function, which
places the formula text in the cell on the indicated worksheet, offset
from the cell containing the FORMULA command on the macro sheet. The
following is an example:
R10C1 =FORMULA("text",Worksheet1!R[3]C)
This feature is by design and is consistent with A1 style references. When a relative reference is placed in a cell, that reference is always relative to the cell containing the formula. In R1C1 notation, an expression of a reference such as R[X]C is treated as an offset from the active cell's row number by X rows. Therefore, the formula used with this notation in a macro sheet modifies the cell in the worksheet that is an offset from the cell containing the formula in the macro sheet. This is true when you use a column offset, such as RC[X], as well, where the reference is offset by X columns.
"Microsoft Excel Function Reference," version 4.0, page 167-169
"Microsoft Excel Function Reference," version 3.0, pages 89-90
"Microsoft Excel Functions and Macros," version 2.2, pages 224-225
Additional query words: macrosheet
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 15, 1999