Excel > Excel 2003 Advanced > Macros

Relative References in Macros

By default when referencing a cell in a macro, Excel uses absolute cell references.

For example, with a macro recording from cell B4, we click on cell B5. When we run the macro from cell H2, Excel would move to cell B5 again.

Using relative references in a macro it would have moved to cell H3 as H3 is in the same relative position to H2 as B5 is to B4.

So by default Excel macros accept the cell reference literally, or what is known as absolute i.e. clicking on cell B5 means B5. With relative references the cell reference is used in relation to the active cell. In the example just given B5 is one cell below B4. So when run in H2 it moves one cell down to H3.

To switch between using absolute and relative references and vice versa in the recording:

  • Click the Relative References button on the Stop Recording toolbar whils recording
  • Relative Reference button

Follow us on

Facebook  Twitter  You Tube