Picture this scene on an interstate. You are standing in a rest area and hear a loud engine roar coming towards you. A powerful red sports car drives into view, revving really hard. It moves past you pretty slowly and continues to rev hard in first gear, so loud that you need to cover your ears to stop going deaf!
At this point you’re probably thinking to yourself “The driver doesn’t know how to drive that car!” as he continues to rev the engine hard in first gear, instead of changing up to second and third. Now keep that picture in mind as I ask the question “Are you using Excel in first gear?”
Let’s assume you know most of Excel’s menus and shortcuts, and are able to use many of Excel’s powerful features such as Pivot Tables and Charting. But if you don’t know anything about macros and VBA, your ability to use Excel is still pretty limited. You to do everything by hand, step by step. It’s like you can’t take Excel’s powerful engine into second or third gear.
Let me show you a quick video to introduce the Macro recorder in Excel 2010, and how we can use a simple recorded macro to change number formats quickly.
Image Credit: Racing car model courtesy of Buckey
Watch this 9 minute video about Macros and VBA in Excel 2010YouTube responded to TubePress with an HTTP 410 - No longer available
Sound Credit: Ferrari355 courtesy of “enginemusic”
Introduction to Macros and VBA in Excel
You can think of a macro as a tape recording. It remembers word for word what you “say” to Excel. VBA = Visual Basic for Applications. This is the language used by Excel to record macros. I wrote another article on this subject here.
Changing number formats in Excel with VBA
The number format we used in the video gives us 2 decimal places, with a comma thousand separator, puts negative numbers in red font between brackets like this (1,015), and has a dash for zero values.
In the macro this is represented by “#,##0.00_);[Red] (#,##0.00);-_)”
If you want to learn more about custom number formats in Excel, I recommend this article by Jon Peltier.
Check out the Google Maps VBA demo
For an example of advanced usage of VBA, check out our Google maps Google Maps in Excel article here. You’ll see that once you master the VBA programming language there is a lot you can accomplish in Excel.
Tell us how you feel about Macros and VBA – Leave a comment below
We’d love to hear how you feel about learning Macros and VBA. It’s a tricky subject to get into, especially if you are not an experienced programmer, but with the right guidance and instruction you will be able to grasp the basics of Macros and VBA. What kind of things would you like to automate in Excel? Looking forward to your comments.