Record a Macro in Excel: automate a task in 2 minutes
A macro is a recording of clicks and keystrokes. Record a task once, replay it with one shortcut. No programming.
What you will make
A macro that formats a heading row: bold, green fill, freeze the top row.
Step 1: show the Developer tab (once)
Right-click the ribbon › Customize the Ribbon › tick Developer › OK.
Step 2: record
- Developer › Record Macro.
- Name:
FormatHeading(no spaces). Shortcut: hold Shift and press F → Ctrl+Shift+F. Store in: This Workbook. OK. - Now do the task: select row 1, press Ctrl+B, pick a fill colour, View › Freeze Top Row.
- Developer › Stop Recording.
Step 3: replay
Open another sheet and press Ctrl + Shift + F. The formatting happens instantly.
Step 4: save it properly
File › Save As › file type Excel Macro-Enabled Workbook (.xlsm). A normal .xlsx throws the macro away.
Check it worked
Close and reopen the .xlsm. Click Enable Content on the yellow bar. Developer › Macros should list FormatHeading.
Common mistakes
The macro touched the wrong cells. Recording saves exact addresses (A1). Click Use Relative References on the Developer tab before recording if the task should start wherever the cursor is.
Shortcut clashes. Ctrl+Shift+letter is safe; plain Ctrl+letter overrides Excel’s own shortcuts.
Macros disabled? See how to enable macros.