Excel Macro: Relative Reference

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.

Excel Macro Relative Reference - Image 1

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.

Excel Macro Relative Reference - Image 2

VBA Code in Edit Mode:

Excel Macro Relative Reference - VBA Code 1

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.

Excel Macro Relative Reference - Image 3

VBA Code in Edit Mode:

Excel Macro Relative Reference - VBA Code 2

Click the Use Relative Reference button on the Developer tab to toggle relative reference on and off.

Local Seminars Related to this Topic:

Microsoft® Excel® Basics

LIVE ONLINE SEMINARS

Jul. 26

Pacific Time Zone

Jul. 27

Central Time Zone

Aug. 4

Pacific Time Zone

Aug. 5

Central Time Zone

Aug. 9

Central Time Zone

Aug. 10

Eastern Time Zone

Aug. 11

Central Time Zone

Aug. 17

Eastern Time Zone

Aug. 19

Central Time Zone

Aug. 23

Central Time Zone

Aug. 25

Central Time Zone

Aug. 26

Pacific Time Zone

Aug. 30

Central Time Zone

Aug. 31

Eastern Time Zone

Sep. 8

Central Time Zone

Sep. 13

Central Time Zone

Sep. 14

Pacific Time Zone

Sep. 16

Eastern Time Zone

Sep. 20

Pacific Time Zone

Sep. 21

Central Time Zone

Sep. 22

Eastern Time Zone

Sep. 27

Eastern Time Zone

Sep. 29

Pacific Time Zone

Sep. 30

Central Time Zone

Oct. 4

Eastern Time Zone

Oct. 5

Central Time Zone

Oct. 7

Central Time Zone

Oct. 12

Central Time Zone

Oct. 13

Central Time Zone

Oct. 14

Pacific Time Zone

Oct. 18

Eastern Time Zone

Oct. 19

Central Time Zone

Oct. 21

Central Time Zone

Oct. 25

Pacific Time Zone

Oct. 27

Central Time Zone

Nov. 1

Central Time Zone

Nov. 2

Central Time Zone

Nov. 3

Eastern Time Zone

Nov. 4

Central Time Zone

Nov. 8

Central Time Zone

Nov. 9

Eastern Time Zone

Nov. 15

Pacific Time Zone

Nov. 17

Central Time Zone

Nov. 18

Central Time Zone

Microsoft® Excel®: Beyond the Basics

LIVE ONLINE SEMINARS

Jul. 27

Pacific Time Zone

Jul. 28

Central Time Zone

Aug. 5

Pacific Time Zone

Aug. 6

Central Time Zone

Aug. 10

Central Time Zone

Aug. 11

Eastern Time Zone

Aug. 12

Central Time Zone

Aug. 18

Eastern Time Zone

Aug. 20

Central Time Zone

Aug. 24

Central Time Zone

Aug. 26

Central Time Zone

Aug. 27

Pacific Time Zone

Aug. 31

Central Time Zone

Sep. 1

Central Time Zone

Sep. 9

Central Time Zone

Sep. 14

Central Time Zone

Sep. 15

Pacific Time Zone

Sep. 17

Eastern Time Zone

Sep. 21

Pacific Time Zone

Sep. 22

Central Time Zone

Sep. 23

Eastern Time Zone

Sep. 28

Eastern Time Zone

Sep. 30

Pacific Time Zone

Oct. 1

Central Time Zone

Oct. 5

Eastern Time Zone

Oct. 6

Central Time Zone

Oct. 8

Central Time Zone

Oct. 13

Central Time Zone

Oct. 14

Central Time Zone

Oct. 15

Pacific Time Zone

Oct. 19

Eastern Time Zone

Oct. 20

Central Time Zone

Oct. 22

Central Time Zone

Oct. 26

Pacific Time Zone

Oct. 28

Central Time Zone

Nov. 2

Central Time Zone

Nov. 3

Central Time Zone

Nov. 4

Eastern Time Zone

Nov. 5

Central Time Zone

Nov. 9

Central Time Zone

Nov. 10

Eastern Time Zone

Nov. 16

Pacific Time Zone

Nov. 18

Central Time Zone

Nov. 19

Central Time Zone

Advanced Microsoft® Excel®-Macros, PivotTables, Charts and More

LIVE ONLINE SEMINARS

Aug. 3

Central Time Zone

Aug. 4

Eastern Time Zone

Aug. 12

Central Time Zone

Aug. 17

Central Time Zone

Aug. 23

Central Time Zone

Sep. 1

Pacific Time Zone

Sep. 9

Eastern Time Zone

Sep. 14

Central Time Zone

Sep. 15

Pacific Time Zone

Sep. 20

Central Time Zone

Oct. 1

Central Time Zone

Oct. 5

Pacific Time Zone

Oct. 6

Central Time Zone

Oct. 12

Central Time Zone

Oct. 21

Central Time Zone

Oct. 25

Eastern Time Zone

Oct. 29

Central Time Zone

Nov. 2

Eastern Time Zone

Nov. 8

Central Time Zone

Nov. 17

Central Time Zone

Nov. 19

Pacific Time Zone

Related Excel® Articles

Leave a Reply

Your email address will not be published. Required fields are marked *