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.

PRYOR+ 7-DAYS OF FREE TRAINING


Courses in Customer Service, Excel, HR, Leadership, OSHA and more. No credit card. No commitment. Individuals and teams.


Choose a Seminar and Save $10:

Microsoft<small><sup>®</sup></small> Excel<small><sup>®</sup></small> Basics

Microsoft® Excel® Basics

Feb. 6

Eastern Time Zone

Feb. 7

Central Time Zone

Feb. 9

Pacific Time Zone

Feb. 13

Pacific Time Zone

Feb. 14

Eastern Time Zone

Feb. 16

Central Time Zone

Feb. 21

Eastern Time Zone

Feb. 22

Pacific Time Zone

Feb. 23

Central Time Zone

Feb. 27

Central Time Zone

Mar. 1

Eastern Time Zone

Mar. 6

Pacific Time Zone

Mar. 7

Eastern Time Zone

Mar. 9

Central Time Zone

Mar. 14

Central Time Zone

Mar. 15

Pacific Time Zone

Mar. 16

Eastern Time Zone

Mar. 20

Pacific Time Zone

Mar. 22

Central Time Zone

Mar. 23

Eastern Time Zone

Mar. 27

Central Time Zone

Mar. 28

Eastern Time Zone

Mar. 30

Pacific Time Zone

Apr. 3

Eastern Time Zone

Apr. 4

Pacific Time Zone

Apr. 5

Central Time Zone

Apr. 11

Eastern Time Zone

Apr. 12

Pacific Time Zone

Apr. 13

Central Time Zone

Apr. 17

Central Time Zone

Apr. 19

Eastern Time Zone

Apr. 20

Pacific Time Zone

Apr. 24

Pacific Time Zone

Apr. 25

Central Time Zone

Apr. 27

Eastern Time Zone

May. 1

Eastern Time Zone

May. 2

Pacific Time Zone

May. 4

Central Time Zone

May. 8

Central Time Zone

May. 10

Pacific Time Zone

May. 11

Eastern Time Zone

May. 15

Pacific Time Zone

May. 16

Eastern Time Zone

May. 18

Central Time Zone

May. 22

Central Time Zone

May. 24

Pacific Time Zone

May. 31

Eastern Time Zone

Jun. 1

Central Time Zone

Microsoft<small><sup>®</sup></small> Excel<small><sup>®</sup></small>: Beyond the Basics

Microsoft® Excel®: Beyond the Basics

Feb. 7

Eastern Time Zone

Feb. 8

Central Time Zone

Feb. 10

Pacific Time Zone

Feb. 14

Pacific Time Zone

Feb. 15

Eastern Time Zone

Feb. 17

Central Time Zone

Feb. 22

Eastern Time Zone

Feb. 23

Pacific Time Zone

Feb. 24

Central Time Zone

Feb. 28

Central Time Zone

Mar. 2

Eastern Time Zone

Mar. 7

Pacific Time Zone

Mar. 8

Eastern Time Zone

Mar. 10

Central Time Zone

Mar. 15

Central Time Zone

Mar. 16

Pacific Time Zone

Mar. 17

Eastern Time Zone

Mar. 21

Pacific Time Zone

Mar. 23

Central Time Zone

Mar. 24

Eastern Time Zone

Mar. 28

Central Time Zone

Mar. 29

Eastern Time Zone

Mar. 31

Pacific Time Zone

Apr. 4

Eastern Time Zone

Apr. 5

Pacific Time Zone

Apr. 6

Central Time Zone

Apr. 12

Eastern Time Zone

Apr. 13

Pacific Time Zone

Apr. 14

Central Time Zone

Apr. 18

Central Time Zone

Apr. 20

Eastern Time Zone

Apr. 21

Pacific Time Zone

Apr. 25

Pacific Time Zone

Apr. 26

Central Time Zone

Apr. 28

Eastern Time Zone

May. 2

Eastern Time Zone

May. 3

Pacific Time Zone

May. 5

Central Time Zone

May. 9

Central Time Zone

May. 11

Pacific Time Zone

May. 12

Eastern Time Zone

May. 16

Pacific Time Zone

May. 17

Eastern Time Zone

May. 19

Central Time Zone

May. 23

Central Time Zone

May. 25

Pacific Time Zone

Jun. 1

Eastern Time Zone

Jun. 2

Central Time Zone

Advanced Microsoft<small><sup>®</sup></small> Excel<small><sup>®</sup></small>-Macros, PivotTables, Charts and More

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

Feb. 7

Pacific Time Zone

Feb. 8

Eastern Time Zone

Feb. 15

Central Time Zone

Feb. 16

Eastern Time Zone

Feb. 21

Central Time Zone

Feb. 23

Pacific Time Zone

Feb. 28

Eastern Time Zone

Mar. 3

Pacific Time Zone

Mar. 7

Pacific Time Zone

Mar. 8

Central Time Zone

Mar. 13

Eastern Time Zone

Mar. 16

Central Time Zone

Mar. 22

Pacific Time Zone

Mar. 30

Central Time Zone

Mar. 31

Eastern Time Zone

Apr. 4

Central Time Zone

Apr. 13

Eastern Time Zone

Apr. 17

Pacific Time Zone

Apr. 21

Central Time Zone

Apr. 26

Eastern Time Zone

Apr. 27

Pacific Time Zone

May. 1

Central Time Zone

May. 2

Pacific Time Zone

May. 10

Eastern Time Zone

May. 11

Central Time Zone

May. 17

Central Time Zone

May. 18

Eastern Time Zone

May. 23

Pacific Time Zone

Jun. 2

Eastern Time Zone

Related Excel® Articles

PRYOR+ 7-DAYS OF FREE TRAINING


Courses in Customer Service, Excel, HR, Leadership, OSHA and more. No credit card. No commitment. Individuals and teams.

Categories