Excel macros
An Excel macro is a series of steps saved as code (VBA) that you can repeat with one click, like formatting, sorting and totaling a report.
Select any words here to ask your Maestro about them.
You record a macro that totals October's sales, rows 2 to 41. November's report has 52 rows of sales. What does the macro add up?
How it's done: with the recorder (View > Macros > Record Macro), which writes your clicks down as VBA code, or by writing the code in the editor (Alt+F11). Macros are saved in .xlsm workbooks.
What it's for: steps you repeat the same way every week: formatting a report, sorting, copying sheets, exporting. For cleaning data that arrives every month, Power Query saves the steps without code, and an AI assistant like Claude for Excel can write the VBA for you.
Be careful: a macro can do anything on your computer, so Excel blocks the ones in files that come from the internet. Enable only the ones in files you trust.
How it's used
Recording a macro
View > Macros > Record Macro
- Name it and, if you want, give it a keyboard shortcut
- Do the steps once: formatting, sorting, totals
- marked: Stop recording and save the workbook as .xlsmAn .xlsx file doesn't keep macros: save it that way and the macro is gone.
When to look closer
Undo after a macro
Delete blank rows
- You run the macro: it deletes 14 rows, and one wasn't blank
- marked: You press Ctrl+Z
Your macro deleted 14 rows, and one wasn't blank. You press Ctrl+Z. What comes back?
Ask your Maestro about Excel macros
It answers from the free course page closest to this word, the way it answers while you study.
You: What does "Excel macros" mean, in plain words?
Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. What do you do the same way in Excel every week?
Asking about: Answers from the page "Why does my running total in SQL repeat numbers?"
Only this browser keeps what you ask here. How it works
Learn more
Related terms
- Power Query
Power Query is the tool in Excel and Power BI for bringing in data and cleaning it with steps that get saved: dropping columns, changing types, filtering rows. When the new file arrives, you click Refresh and every step runs again on its own.
- Claude for Excel
Claude for Excel is Anthropic's add-in that puts Claude inside Excel: it reads your workbook, answers with citations to the cells, writes formulas and makes changes in the same file.
- Copilot in Excel
Copilot in Excel is Microsoft's AI assistant inside Excel: you ask for an analysis in your own words, and it builds formulas, PivotTables, charts or summaries in your workbook.
- Pivot table
A pivot table summarizes a long table in seconds: it groups by the columns you pick and sums, counts or averages another, with no formulas.