Excel Macro Recorder Commands and How to Use Them

VBA & macros · Updated November 6, 2026

Excel Macro Recorder Commands and How to Use Them

In Excel for Microsoft 365 on Windows, the main macro recorder commands are Developer > Code > Record Macro and Developer > Code > Stop Recording. The recorder turns many actions you take in a worksheet into VBA instructions; there is no separate command language to learn, but you should review the generated macro before relying on it.

What macro recorder commands mean

A macro is a saved sequence of instructions that can repeat work in a workbook. When you record a macro, Excel observes supported actions—such as entering values, formatting cells, sorting a range, or changing a worksheet—and writes corresponding VBA code. Playing the macro runs those instructions again.

So, people asking for “macro recorder commands” may mean either the ribbon controls for recording and playing a macro or the VBA instructions the recorder creates. The ribbon controls start and stop recording; the generated VBA contains the operational commands. For example, a formatting task can produce instructions that select a range and change its number format, font, or fill. The exact code depends on the actions and selections made while recording.

Recording is useful for learning basic VBA and automating a repeatable sequence. It is not a plain-language transcription: Excel may record details about the active selection, workbook, and interface state. A macro that works once can fail or affect the wrong cells if the workbook is arranged differently the next time.

Start and stop a recording

If the Developer tab is hidden in Excel for Microsoft 365 on Windows, enable it through File > Options > Customize Ribbon, select Developer in the Main Tabs list, and choose OK. Then use Developer > Code > Record Macro. In the dialog, give the macro a name, optionally assign a shortcut, choose where to store it, and add a description if useful. Choose OK to begin recording.

Carry out the steps you want Excel to repeat, then choose Developer > Code > Stop Recording. Stop as soon as the intended task is complete: Excel records supported actions during the whole recording period, including extra selections or corrections you did not mean to make part of the macro.

  • Macro name: Use a descriptive name without spaces, such as FormatMonthlyReport. Names must follow VBA naming rules; starting with a letter is a safe choice.
  • Shortcut key: You can assign a shortcut in the recording dialog. A shortcut can override a built-in Excel shortcut, so avoid combinations you depend on.
  • Store macro in: Choose This Workbook to keep it with the current file, or Personal Macro Workbook to make it available in Excel on that computer.
  • Description: Briefly record what the macro changes and any assumptions, such as which sheet or range it expects.

Excel does not provide one universal default keyboard shortcut for starting a recording. You can assign a shortcut when creating a macro. Alt+F8 opens the Macro dialog in Windows, where you can select and run a saved macro; it does not start recording.

Common recorder controls and recorded actions

The primary controls are Record Macro, Stop Recording, and Use Relative References. You can find the first two on the Developer tab under Code. Use Relative References is a toggle in the same Code group; its state determines whether recorded cell movements are tied to fixed addresses or to the starting position. The Macro dialog, opened with Developer > Code > Macros or Alt+F8, lets you select an available macro to run, edit, or delete.

Recorded instructions can cover routine worksheet work, including typing or clearing contents, applying formatting, selecting cells, inserting rows or columns, and using some sorting or filtering commands. The recorder captures the sequence, not the reason for it. If you sort a particular block, for instance, the macro may repeat that operation on the same address rather than identify a new block automatically.

Not every Excel feature or interaction is recorded as a dependable VBA instruction. Some interface actions, dialogs, add-in features, and actions outside Excel may not be captured as expected. If an operation is missing or playback behaves differently, inspect the macro in the Visual Basic Editor instead of assuming the recorder captured everything.

Absolute and relative references

By default, recorded cell references are generally absolute: a macro recorded while working in A1 may return to A1 when replayed. That is appropriate when the task must always affect a fixed location, such as applying a title format to a known report cell.

Turn on Developer > Code > Use Relative References before recording when the same sequence should operate relative to the selected starting cell. For example, recording a move one cell down and applying a format can then repeat that movement from a different starting point. This does not make a macro fully adaptable: it still follows its recorded sequence and may depend on the active sheet, selection, or workbook layout.

Check whether the toggle is on before recording. If the result behaves as though it is anchored to the original cells, stop playback and review the recording settings and generated code. Switching the toggle after recording does not rewrite an existing macro; it affects subsequent recordings.

A practical example: repeatable report formatting

Suppose a monthly report always arrives with a heading row that needs bold text, a colored fill, and a date column formatted consistently. First open a copy of the workbook, select the intended heading cells, start recording, apply the formatting from the Home tab, select the date range and apply the needed date format, and then stop recording. Run the macro on a test copy to see whether it changes only the expected cells.

Before recording, decide whether the report uses the same worksheet and cell addresses every month. If it does, absolute references may be suitable. If the formatting should start at whichever heading is selected, relative references may help, though the selection must be correct when the macro runs. If the report length varies, a simple recording may format only the rows present during recording. That is a sign the macro may need editing or a more flexible VBA approach.

Keep the task narrow. A macro that formats a heading and a date range is easier to check than one that also opens files, changes sheets, sorts data, and saves the workbook. Use clear names and descriptions so a future user can tell what the macro is intended to do.

Review, edit, and run the generated macro

Choose Developer > Code > Macros, select the macro, and choose Edit to open its VBA procedure in the Visual Basic Editor. You can also open the editor with Alt+F11 on Windows. The recorded procedure is a useful starting point, but it may contain many selection and activation steps that are unnecessary or make it brittle. Someone comfortable with VBA can simplify these steps or add checks, such as confirming the expected worksheet is active.

To run a macro, use Developer > Code > Macros, select its name, and choose Run, or use its assigned shortcut. Test it on a duplicate workbook first and compare the result with the intended changes. Excel macros cannot be undone with Ctrl+Z, so ordinary Undo is not a safety net after a macro has run.

On Excel for Mac, the Developer tab can be enabled from Excel > Settings > Ribbon & Toolbar, then used to access macro commands. Keyboard shortcuts differ between Windows and Mac, and a shortcut assigned to a macro may conflict with another shortcut on either system. Excel for the web can open macro-enabled workbooks, but it cannot create, run, or edit VBA macros; use the desktop Excel app for those tasks.

Saving, compatibility, and macro security

If a workbook contains VBA, save it in a macro-enabled format such as Excel Macro-Enabled Workbook (*.xlsm). Saving as a standard .xlsx file removes VBA macros. If you choose Personal Macro Workbook, Excel stores the macro separately for use on that computer, rather than embedding it in each workbook; that file is typically loaded when Excel starts.

Excel may block macros from files it considers untrusted. Only enable macros when you trust the source and understand what the workbook is intended to do. A recorded macro can make changes to workbook data, and VBA can do more than worksheet formatting. Do not treat a familiar-looking workbook as safe solely because it contains a macro recorder output.

  • Keep an unchanged backup before running a macro that edits important data.
  • Use a descriptive macro name and document the worksheet or range it expects.
  • Test with sample data and inspect the result before using it on the original workbook.
  • Share the macro-enabled file only with people who need it, and explain its purpose.

Common problems and alternatives

If a macro runs but changes the wrong cells, check whether the recording used absolute references, whether the expected sheet is active, and whether the workbook layout has changed. If the macro is not listed, check that it was saved in the workbook you opened or in the Personal Macro Workbook. If Excel removes it after saving, confirm that the file was saved as .xlsm rather than .xlsx.

If playback is blocked, review Excel’s macro security message and the file’s source; do not bypass security for an unfamiliar file. If a recorded action is absent, try recording a shorter sequence and inspect the VBA, or consult Excel’s built-in VBA documentation for the feature. For repetitive tasks that only transform and combine imported data, Power Query may be easier to maintain than a recorded macro. For simple formatting, Excel’s built-in styles or conditional formatting may avoid VBA altogether.

A recorder is best when the task is predictable and a fixed sequence is genuinely useful. It is less suitable when the number of rows changes, decisions depend on cell values, or the process must handle errors and different workbook layouts. Those cases usually require carefully written VBA, another Excel feature, or a repeatable process outside macros.

Frequently Asked Questions

What is the shortcut to record a macro in Excel?
There is no universal default shortcut to start recording. Use Developer > Code > Record Macro and assign a shortcut in the dialog if you want one. Alt+F8 opens the Macro dialog; it does not begin recording.

Where do I find the commands created by the recorder?
Open Developer > Code > Macros, select the macro, and choose Edit. Excel opens the procedure in the Visual Basic Editor, where you can review the VBA instructions.

Why does my recorded macro keep changing the same cells?
The recording likely uses fixed, absolute references. Turn on Use Relative References before making a new recording if the steps should be relative to the starting selection. Existing macros are not changed by toggling this option.

Can I record macros in Excel for the web?
No. Excel for the web does not create, run, or edit VBA macros. Open the workbook in desktop Excel for Windows or Mac to use the VBA macro recorder.

Can I undo a macro with Ctrl+Z?
No. Running a VBA macro clears Excel’s normal undo history, so Ctrl+Z cannot reverse its changes. Save a separate copy and test the macro before using it on important data.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.