If you’re stuck doing the same thing in Excel again and again and again—such as formatting cells, generating reports, or copying data—then macros can save you loads of time and effort. In this blog, we’ll guide you through what Excel macros are, why you should care, and how to use them—even if you’re not tech-savvy!
What Is a Macro in Excel?
A macro is a group of instructions that Excel can execute to do something for you automatically. Imagine that you press “record” on your steps, and then let Excel redo them anytime with the click of one button.
For instance: You might record a macro to bold the headers, insert borders, and shade cells in a report—then run it each week with no manual effort.
How Do Macros Work?
Macros are programmed using a language called VBA (Visual Basic for Applications), but you don’t need to learn it immediately. Excel includes an in-built Macro Recorder that can automatically write the code for you while you do your work.
Step-by-Step How to Record a Macro
- Open Excel and go to the “View” tab.
- Click “Macros” → “Record Macro”.
- Give your macro a name (no spaces).
- Choose where to store it:
This Workbook: Only in this file
Personal Macro Workbook: Available in all Excel files - Do your usual steps (e.g., formatting a table).
- Click “Stop Recording” under the “View” tab.
That’s it! Your actions are now recorded as a macro.
How to Run a Macro
- Go to “View” → “Macros” → “View Macros”.
- Choose your macro.
- Click “Run”.
You can even add the macro to a button on the worksheet for one-click operation.
Common Tasks You Can Automate with Macros
- Formatting cells and tables
- Making monthly reports
- Adding company headers/footers
- Deleting duplicate entries
- Importing and preprocessing data
- Creating charts or pivot tables
Do You Want to See the Code?
When you’ve recorded, you can see and modify your macro by using Alt + F11 to display the VBA Editor. This makes it easier to refine or add to the macro in the future.
A Few Things to Remember
- Macros can’t be reversed like normal actions. Save your file first before executing one.
- Macros are turned off by default to ensure security. Turn them on if asked when the file is trusted.
- Save your file with the extension .xlsm (macro-enabled workbook) to preserve the macro.
Final Thoughts
Excel macros can make hours of labor seconds—without having to be a programmer to use them! Begin with the macro recorder, experiment with basic VBA as you expand, and before long you’ll be amazed at how you ever did without automation.