563 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
How to record macros in Excel Visual Basic
Part six of a six-part series of blogs
If you're not sure what the Excel Visual Basic for Applications language is (or how it can help you) this blog attempts to explain! Learn what VBA is, and how you can record macros and then replay them again and again to automate work in Excel.
You can play a macro that you've recorded (and possibly edited) in several ways:
The rest of this blog shows how to do each of these things.
If you've assigned a short-cut key to your macro, you can press it now. In our case, it was SHIFT + CTRL + R.
The steps to assign a macro to a button are shown below:
To insert a button:
You can now click and drag to form the outline of your button:
Click and drag with the plus symbol to draw your button.
When you release the mouse button, you can choose which macro to assign to your button:
Choose from the list of macros that you've written - this appears automatically.
Finally, you can change the text displayed on your button:
Click and drag across the text of the button, and type something else in.
You've now got a clickable button! Note that in Excel 2003 you can achieve the same thing from the Forms toolbar:
Right-click on any Excel 2003 toolbar and choose to display the Forms toolbar (from this you can insert a command button).
The only hard thing about assigning a macro to a picture is choosing the right picture!
Paste any picture onto your worksheet, then right-click on it to assign a macro to it as shown here.
This option is different - and more complicated - in Excel 2003, so only the 2007/2010 method is shown here.
Our aim is to get an icon to appear on the Quick Access toolbar, so start by right-clicking on it:
Right-click anywhere on the toolbar at the top left of Excel to customise it
You can now choose a macro to assign to it:
Follow the numbered steps below!
The numbered steps shown above are:
If you follow these steps carefully, you'll end up with a custom icon:
Here I've gone for a pi symbol (or should that be tau?), for no particular reason. Clicking on this tool will run the macro.
Your customised quick access toolbar will remain visible even when the workbook containing your macro is closed down. If you click on the icon in this case, Excel will automatically open the workbook and then run the macro, which is pretty much what you'd want and expect.
So that's how to record macros! The next step, perhaps, is to learn how to write macros ...
|Parts of this blog|
25 Aytoun Street