Excel Macro: Relative Reference
- Author: Excel Tips and Tricks from Pryor.com
- Categories:
- Tags:
- Share on:
Excel records Macros in absolute mode by default. In absolute mode, a Macro will start working in the same cell it was in when it was recorded. If, when it was recorded, A1 was the active cell, then it will return to A1 and begin working from there no matter which cell was selected prior to starting the Macro.
When you turn on Relative Reference before recording a Macro, it will start the Macro “relative” to whatever cell is currently selected. This makes the Macro more flexible.
Example:
If you start recording the Macro in Cell A6 and insert a row:
With Absolute Reference – no matter what cell is selected the Macro will always insert a row at Row 6.
VBA Code in Edit Mode:
With Relative Reference – the macro will insert a row relative to the cell selected. If Cell A9 is selected, the macro will insert a row at Row 9.
VBA Code in Edit Mode:
Click the Use Relative Reference button on the Developer tab to toggle relative reference on and off.
Choose a Seminar and Save $10
Microsoft® Excel® 2013: Beyond the Basics
1 Day
- CEU: 0.6
- CPE: 6
Team Training - Virtual or In-person
Microsoft® Excel®: Beyond the Basics
1 Day
- CEU: 0.6
- CPE: 6
- PDU: 6
Virtual Seminars:
-
Dec 17
-
Dec 19
-
Jan 7
-
+ 35 more dates