Advanced Excel · Intermediate level

Intermediate level · Module 5: Automating Excel · Lesson 1 of 3

Recording Macros

Record repetitive steps as macros and run them with a button or shortcut.

In this lesson you will

  • Record and run a macro
  • Choose absolute or relative recording

Key concepts

macro recorderrelative referencesmacro-enabled workbookassigning to a button

The lesson

The macro recorder writes VBA code as you perform steps, such as formatting a report. Running the macro repeats them in seconds.

By default the recorder uses absolute cell references; switch on relative references when the macro should work from the selected cell.

Save as a macro-enabled workbook (.xlsm) and assign macros to buttons for users.

Step by step

  1. Record a macro that formats a report.
  2. Run it on new data.
  3. Record again with relative references.
  4. Assign the macro to a button.

Practice activity

Record a macro that prepares the monthly report for printing.

Expected result: A macro that formats new reports correctly in one click.

Check your understanding

  1. In which format must macros be saved?

    Show answer

    A macro-enabled workbook (.xlsm).

  2. When should relative recording be used?

    Show answer

    When the macro should work from whichever cell is selected.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.