Microsoft Office Tutorials and References
In Depth Information
Working with Macros
The most obvious benefit to creating macros in Excel is that you can automate repetitive
tasks. While there’s a lot more to macros and Visual Basic for Applications than repeating a
series of actions without the need for human intervention, it’s a great place to start. This sec€
tion shows you how to record macros, run them using the method you find easiest, and use
the built-in macro security capabilities to guard against viruses.
Recording and Viewing Macros
Recording a macro in Excel 2003 is a straightforward process: you click Tools, Macro, Record
New Macro to display the Record Macro dialog box (depicted in Figure 3-1).
Figure 3-6. The Record Macro dialog box provides an interface for managing the macros in
your workbook.
Type the name of the macro you want to create into the Macro Name box, and click OK. The
Record Macro dialog box will go away, to be replaced by the Stop Recording toolbar.
You’re recording! Perform the actions you want to be included in your macro, click the Stop
Recording button on the Stop Recording toolbar, and your macro is ready for use. As with
any programming effort, you should plan what you want to do so you can do it as quickly and
efficiently as possible. You should also practice the macro a few times so you are sure your
actions generate the desired result.
When you’re done recording a macro, you can view the VBA code Excel created by clicking
Tools, Macro, Macros, <macro_name> , Edit. Your macro will appear in the Visual Basic
Editor, as shown in Figure 3-2.
Note You’ll see a lot more of the Visual Basic Editor in Chapter 4, “VBA Programming
Starter Kit."
Search JabSto ::




Custom Search