How to Record a Macro in Microsoft Excel
This guide covers Excel's built-in macro recorder, not standalone macro recorder software. For standalone tools, see the main Best Macro Recorders page.
Excel's built-in macro recorder captures your actions inside a spreadsheet and saves them as a VBA (Visual Basic for Applications) script. Run the macro again with one click to repeat the same task automatically.
How to Enable the Developer Tab in Excel
- On Windows: File > Options > Customize Ribbon > check "Developer" > click OK
- On Mac: Excel > Preferences > Ribbon and Toolbar > check "Developer" > click Save
How to Record a Macro
- Open the workbook you want to automate.
- Click Developer > Record Macro. A dialog box opens.
- Name your macro (no spaces - use underscores). Assign an optional shortcut key. Choose storage: "This Workbook" or "Personal Macro Workbook".
- Click OK. Excel is now recording every action you take.
- Perform the task - format cells, enter formulas, sort data, copy ranges.
- Click Developer > Stop Recording (or the Stop icon in the status bar at the bottom left).
How to Run an Excel Macro
- Method 1: Use your assigned shortcut key.
- Method 2: Developer > Macros > select your macro > click Run.
- Method 3: Add a button: Developer > Insert > Button, draw it on the sheet, assign your macro.
How to Edit a Recorded Excel Macro
Go to Developer > Macros > select your macro > click Edit. Excel opens the Visual Basic Editor. Example of a recorded macro:
Sub FormatHeaders()
Range("A1:E1").Select
Selection.Font.Bold = True
Selection.Interior.Color = RGB(173, 216, 230)
End SubExcel Macro Recorder vs Standalone Macro Recorders
Excel's recorder only captures actions inside Excel. For automating tasks across multiple applications, use a standalone macro recorder. See /best-macro-recorders for the full comparison.
Frequently Asked Questions
Where is the macro recorder in Excel?
Developer tab > Record Macro. If Developer is not visible, go to File > Options > Customize Ribbon and check Developer.
Can I record a macro in Excel without the Developer tab?
Yes. Go to View > Macros > Record Macro.
Will my macros work on another computer?
Macros stored in "This Workbook" travel with the .xlsm file. Macros in the "Personal Macro Workbook" stay on your machine and must be exported manually to transfer.
Does Excel macro recording work on Mac?
Yes. The Developer tab and Record Macro feature are available in Excel for Mac.