56 free macros indexedAll toolsHow to runBlogGitHub ↗

How to Record a Macro in Excel

To record a macro in Excel, enable the Developer tab, click Record Macro, name it, perform your steps, then click Stop Recording.

2026-09-05

How to record a macro in Excel

To record a macro in Excel, enable the Developer tab, click Record Macro, give it a name, perform the steps you want to automate, then click Stop Recording. Excel writes the VBA for you, and you never have to read a line of it.

The recorder is genuinely the fastest way to automate a repeated task. It also has one built-in limitation that catches people out a month later, and it is worth knowing before you rely on a recorded macro.

TL;DR: Key takeaways

  • Turn on the Developer tab first. It is hidden by default.
  • Developer > Record Macro, name it, act, then Stop Recording.
  • Macro names cannot contain spaces and must start with a letter.
  • A recorded macro is frozen to the range you recorded on. Add a row later and it will be skipped.
  • Recorded macros cannot be undone, so work on a copy the first time you run one.

Turn on the Developer tab first

Every recorder command lives on the Developer tab, which Excel hides by default. Enabling the Developer tab covers the setting in full, including what to do when it will not stick.

  • Windows: File > Options > Customize Ribbon, then tick Developer under Main Tabs and click OK.
  • Mac: Excel > Preferences > Ribbon & Toolbar, tick Developer under Main Tabs, then Save.

Record the macro

  1. On the Developer tab, in the Code group, click Record Macro. On Windows, Alt + T + M + R does the same thing.
  2. Type a name in the Macro name box. Make it descriptive.
  3. Optionally set a shortcut key and a description.
  4. Choose where to keep it in the Store macro in list.
  5. Click OK, then perform the actions you want to automate.
  6. Click Stop Recording on the Developer tab.

Two rules on the name, both from Microsoft: the first character must be a letter, and spaces are not allowed, so use an underscore as a word separator. A name that also looks like a cell reference can trigger an invalid-name error.

Be careful with the shortcut key. It overrides the matching Excel shortcut for as long as that workbook is open, so assigning Ctrl + Z costs you Undo in that session.

This Workbook keeps the macro in the current file. Personal Macro Workbook makes it available in every workbook on that computer, and Excel creates the hidden Personal.xlsb file to hold it.

The limitation worth knowing first

A recorded macro remembers the exact cells you touched, not what you meant.

Microsoft states it plainly: when you record a task over a range, "the macro will only run on the cells within the range. So if you added an extra row to the range, the macro will not run the process on the new row." Record a cleanup over rows 2 to 51 in January, add ten rows in February, and the macro quietly handles the first 50 and ignores the rest. Nothing errors. The output just looks finished when it is not.

This is the real difference between a recorded macro and a written one. Every tool in our free library works on whatever you have selected, so the same macro handles 50 rows or 5,000 without edits. A recorder cannot produce that, because it has no way to know that the range was the part you wanted to stay flexible.

The practical habit is to re-record when your data grows, or to open the code and widen the range by hand.

What the recorder cannot capture

The recorder writes down actions. It cannot write logic.

It has no way to record a decision ("only if the cell is blank"), a loop ("repeat for every sheet"), or a variable. Microsoft's guidance is to add those in the Visual Basic Editor afterwards, since they are things "the Macro Recorder cannot record."

It also records your mistakes. The recorder captures almost every move you make, so a stray click lands in the code alongside the useful steps. The fix is to re-record the sequence or edit the code, which is why it pays to rehearse a process once before recording it.

Microsoft's own example of a good recorder job is applying one date format to a column of inconsistent dates. That is a fair use: a fixed, mechanical, repeated sequence. For that particular job the Standardize Dates macro already handles the messy cases, including dates stored as text.

Frequently asked questions

Do I need to know VBA to record a macro?

No. The recorder writes the code for you, and Microsoft is explicit that knowing VBA is not necessary if the recorder does what you want. You only need the Visual Basic Editor when you want to change the recorded macro or add logic it cannot record.

Can I undo a macro after running it?

No. Macros cannot be undone, and running one clears the undo history. Microsoft recommends saving the workbook first, or working on a copy, before you run a recorded macro for the first time. If the result is wrong, close without saving.

Where should I store a recorded macro?

Use This Workbook when the macro only makes sense for that file. Use Personal Macro Workbook when you want it available in every workbook on that computer. The second option creates a hidden Personal.xlsb that opens with Excel each time.

Why does my recorded macro skip new rows?

Because it recorded the original range, not the idea of "all my data." Rows added afterwards sit outside that range and are ignored. Re-record the macro over the larger range, or edit the range in the code.

Can I record a macro in Excel for the web?

No. Excel for the web cannot create, run, or edit VBA macros, and neither can the iOS or Android apps. Recording needs desktop Excel on Windows or Mac.

What to do next

Record something small first, a format or a repeated cleanup, then open it with Alt + F8 and read what Excel wrote. Editing a recorded macro is the natural next step, and running a macro someone else wrote covers the other direction. The VBA guide for non-coders explains what the recorded lines actually mean.