WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 482 reviews for our classroom and online training
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.

  1. How to Record Macros in Excel Visual Basic
  2. What is Excel VBA, and how can you use it?
  3. Starting to Record Macros in Excel VBA
  4. Recording your Macro and Finishing
  5. Tidying up your macro that has been recorded
  6. Playing back your macro recorded in Excel VBA (this blog)

This blog is part of our Excel macros online tutorial series - complemented, of course, by Wise Owl's excellent training courses in VBA and Excel for businesses like yours!

Posted by Andy Brown on 30 June 2011

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Playing back your macro

You can play a macro that you've recorded (and possibly edited) in several ways:

  • by pressing the relevant short-cut key
  • by creating a button on your worksheet
  • by assigning it to a picture or drawing
  • by adding a button to the Quick Access toolbar (or creating a new toolbar in Excel 2003)

The rest of this blog shows how to do each of these things.

Running a Macro Using a Short-Cut Key

If you've assigned a short-cut key to your macro, you can press it now.  In our case, it was SHIFT + CTRL + R.

 Running a Macro Using a Button

The steps to assign a macro to a button are shown below:

Ribbon option to insert a button

To insert a button:


You can now click and drag to form the outline of your button:

Dragging to create a 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:

Assigning a macro to a form button

Choose from the list of macros that you've written - this appears automatically.


Finally, you can change the text displayed on your button:

Changing command button text

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:

The Excel 2003 Forms toolbar

Right-click on any Excel 2003 toolbar and choose to display the Forms toolbar (from this you can insert a command button).


 Running a Macro Using a Picture

The only hard thing about assigning a macro to a picture is choosing the right picture!

Right-clicking on picture to assign macro

Paste any picture onto your worksheet, then right-click on it to assign a macro to it as shown here.


Running a Macro from the Quick Access Toolbar

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:

Customising the Quick Access toolbar

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:

Assigning a macro - the steps

Follow the numbered steps below!

The numbered steps shown above are:

  1. Choose to display a list of macros.
  2. Double-click on the macro you want to assign an icon to.
  3. Click on the macro where it appears in the right-hand list to select it.
  4. Click on the button to modify the icon, and choose a different picture.

If you follow these steps carefully, you'll end up with a custom icon:

The final quick access toolbar

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 ...

This blog has 0 threads Add post