PTS Blog

Main menu:

PTS Utilities

Commercial Utilities developed by Peltier Technical Services

  Waterfall Chart

Excel Books

Books that I own and use while developing in Excel

Goods and Services

Excel or charting related products and services which I use or feel are worthwhile additions

Subscribe

Site search


Recent Posts

Recently Commented

March 2008
S M T W T F S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Archive


 

Categories


 

How To: Record Your Own Macro

by Jon Peltier
Peltier Technical Services, Inc., Copyright © 2008. All rights reserved.

In a recent post, I showed how to copy someone else’s VBA procedure (i.e., “macro”) and paste it into your own workbook. Fortunately you don’t have to rely on others for custom macros. Excel includes a Macro Recorder which captures your actions, so that you can replay them later, saving yourself time and keystrokes.

It’s easy to record and rerun macros. You can start the Macro Recorder in a number of ways.

  • Tools menu > Macro > Record New Macro
  • Record Macro button on the Visual Basic toolbar
  • Record Macro Button

    The Macro Recorder will now record all of your steps until you turn it off, using one of several methods.

    • Tools menu > Macro > Stop Recording
    • Stop Recording button on the Visual Basic toolbar
    • Stop Recording button on the Stop Recording toolbar

    Stop Recording Button  Stop recording Button

    To see your handiwork, go to the VB Editor (VBE). There are three ways to get there:

    • Tools menu > Macro > Visual Basic Editor
    • Visual Basic Editor button on the Visual Basic toolbar
    • Shortcut key combo Alt+F11

    VB Toolbar - VB Editor Button

    If your workbook had no macros to begin with, the Macro Recorder creates a new code module, which you can see in th Project Explorer Window. If the Project Explorer isn’t visible, go to View menu > Project Explorer.

    Project Explorer

    To view the macro you’ve recorded, double click on the new code module.

    Code Module with Recorded Macro

    The macro can be run in a number of ways:

    • Tools menu > Macro > Macros, select the Macro, and click Run
    • Shortcut Key combo Alt+F8, select the Macro, and click Run
    • Run Macro button on the Visual Basic toolbar, select the Macro, and click Run
    • Click in the macro with the mouse and press F5

    Run Macro Button

    This is the first exposure most people have to VBA programming. In a series of upcoming posts, I’ll cover the following VB topics:

    Share/Save/Bookmark

    Write a comment





    Create Excel dashboards quickly with Plug-N-Play reports.