A macro is a saved list of actions that Excel can repeat. If you do the same formatting, copying or cleaning every day, a macro can do it in one click.
Record your first macro
- Turn on the Developer tab (File → Options → Customize Ribbon).
- Click Record Macro, give it a name, and do your steps once.
- Click Stop Recording.
- Run it from Macros or assign it to a button.
Read the code
Press Alt + F11 to open the VBA editor. Your recorded steps are saved as code. Reading it is the best way to start learning VBA.
Core VBA ideas
- Variables store values, for example a row count.
- If statements make decisions.
- Loops repeat an action over many rows.
- Ranges and sheets let the code read and write cells.
Stay safe
Macro-enabled files use the .xlsm format. Only enable macros in files from people you trust, and keep a backup before running new code on real data.
When not to use VBA
If Power Query or a pivot table can do the job, use that first. Use VBA for steps that need real automation, like building and saving a report file.
Go deeper
Chapter 8 of our Advanced Excel course teaches the macro recorder, variables, loops, ranges, buttons and error handling, and ends with an automated report project.