O'Reilly logo

Excel 2003: The Missing Manual by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Macro Recorder

The macro recorder is easy to use, but it's important to keep a few key points in mind while you're recording, so that you end up with a great collection of really useful tools:

  • Excel is watching you. Excel captures every menu selection or keyboard shortcut you use. In other words, don't do anything that you don't want recorded as part of the macro, unless you're willing to edit the VBA macro code after the fact. Also, try to avoid switching to another program while you're recording an Excel macro. Even though the macro recorder will ignore anything you do outside of Excel, it's easy to confuse yourself and inadvertently add macro code you don't want by jumping back and forth.

  • You don't need to work fast. The macro recorder doesn't record anything in between each action you perform. For example, if you browse through the menu for 20 minutes before you eventually select File Print, Excel just adds a single line of VBA code to your macro—the line it needs to invoke the File Print command. As a result, macros tend to execute very quickly when you replay them—much more quickly, in fact, than when you perform the actions yourself.

  • Try to be generic. The ideal macro is general enough that you can reuse it in a wide range of scenarios. If you make a macro so specific that you can use it only once, the macro won't get much use, and all your hard work will be wasted.

Before you jump into the macro recording studio, it helps to understand the difference between recording ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required