Last updated on December 18, 2024 By Victor Chan
If you're an analyst, you likely receive new data every month. Since the data always comes in the same format, macros can help you automate your report preparation.
Imagine that with just a few clicks, your regular reports are done in seconds. I'll show you how to use Excel macros to automate your reporting. It's easier than you might expect, and you'll learn how to transform raw data into a polished report efficiently.
Let's tackle this in four steps, and make sure to stick around to the last step because I'll share a little-known hack that can save you even more time.
Watch every step in my YouTube video tutorial.
Download FREE Excel Workbook
Step 1: Sign up for free Click Here
Step 2: Log in for access Click Here
Step 3: Download file Excel Macro Reporting.zip
Are you new to Excel VBA Macros?
• Find out how to enable and disable macros in Excel with this tutorial
• Save time and effort by copying VBA macros from one workbook to another with these instructions
Here’s what we want to achieve with our first macro. We’ll take the plain data and add a nicely formatted header.
Here’s the worksheet with the header applied:
To begin, we need to enable Excel’s Developer Tab to access the tools for recording macros.
Recording the First Macro:
While recording, take the following actions. If you make a mistake, it’s fine to start over again. Just take your time. Excel will record almost all of your actions.
If you want to watch and follow along with the steps I take, check out my YouTube video.
Test Your Macro:
Open up the Macros dialog box (Developer Tab → Macros). Click on Step_1_Header to run it on new data to confirm it applies the header formatting correctly.
It’s always a good idea to test your macros on “dummy data”.
Since there’s no undo button on recorded macros, it’s also a good idea to save your file before running them.
Finally, an important thing to do is to Save Your Workbook.
Always save as an Excel Macro-Enabled Workbook (.xlsm) to retain the macros.
If you save an an Excel Workbook (.xlsx) you’ll lose your macros!
Now let’s record a macro to format the table and make it easier to read.
This is what the table looks like after we apply the formatting.
Recording the Second Macro:
Test the Table Macro: Open up the Macros dialog box (Developer Tab → Macros). Click on Step_2_Table to run it on more test data and ensure everything works smoothly.
Of course you can record any formatting steps you want. The steps I’ve shown are suggestions based on the look I wanted to get, but feel free to use your own formatting and colors.
In this step, we’ll create a macro to generate a column chart that compares target and actual sales.
This is a combo chart that uses 1. a line with markers for the horizontal “target” bars, and 2. a clustered column for the vertical “actual” bars.
Here are the steps. You can watch the YouTube video for details.
Test the Chart Macro: Open up the Macros dialog box (Developer Tab → Macros). Click on Step_3_Column_Chart to run it on more test data and ensure everything works smoothly.
Troubleshooting Tip: If you encounter a runtime error, it’s probably because Excel didn’t find the chart object that was recorded by the macro recorder. Use the VB Editor (Alt + F11) to remove the problematic line of code and re-run the macro. Watch my video for exactly what to do.
After running our recorded macros we transform our plain data into a well formatted report.
This is what the final report looks like:
If you remember, earlier in steps 1 to 3 we opened the Macros menu to run each macro:
This takes a few clicks because after a macro finishes running the Macros dialog box closes and we need to open it again to run the next one.
Can we do it faster?
Yes, it turns out we can run our macros by assigning keyboard shortcuts, so we don’t need to open the Macros menu every time we want to run our macros.
Here’s how:
With these four steps, you can automate your Excel reports and save hours of time every week.
But remember, macros are just the beginning. If you want to learn how to unlock the full power of automating Excel using VBA, check out my online course. It's helped over 500 students master Excel Macros and VBA in weeks, not years.
Learn more by clicking here.
Hi, I'm Victor!
Are you struggling with complex Excel tasks? Feeling overwhelmed by spreadsheets that are hard to use?
Many people believe mastering Excel is about learning shortcuts, functions, and formulas. But this overlooks the importance of building practical, real-world applications. It's not just about knowing the tools. It's about using them effectively.
That's where I come in. You'll get a unique perspective to Excel training from me. I have over 20 years of experience at Deloitte and two global tech companies. And I know what can make a difference in your career.
Let me help you integrate Excel into your professional life. Starting today. Read one of my articles, watch one of my videos. Then apply the new technique to your work. You'll see the difference immediately!
Discover the PROVEN Blueprint for transforming your Excel skills, supercharging your productivity, and standing out in your career! My course helps you to learn Excel VBA and save hours of time even if you have zero prior experience with programming.
Solve tricky Excel problems and take your work to the next level! Get customized solutions for your unique needs. Save time and gain insights with truly expert Excel solutions from only $97 per task.
Get a clear overview of your project progress using the Excel project timeline. Use it to communicate the big picture, track task progress, and stay on top of your project goals. Stay organized with our project timeline!
Our cheat sheets provide quick and easy reference to commonly used Excel VBA concepts and code snippets.
Unlock new levels of productivity and efficiency with our cheat sheets, and write VBA code like a pro in no time.
RECOMMENDED READING
Are you looking to upskill and stay ahead of the curve? Excel is a powerful tool that keeps growing in demand. We round up the best online courses for learning Excel.
Are you looking to up your spreadsheet game? Excel is an invaluable tool that can help you stay organized and save time. From data analysis to budgets, Excel can do it all!
Today, having Excel skills is more critical than ever. Those who know how to use Excel are more likely to find higher-paying jobs. And get promoted faster.