Microsoft Office Tutorials and References
In Depth Information
Automating Your Work with Macros
11
Chapter
Automating Your Work
with Macros
In the course of your work with Excel you may find yourself having to carry out the same
data entry tasks repeatedly, such as entering your company’s name and address at the
top of many of your spreadsheets. Rather than having to perform that recurring (and
irritating) chore over and over again, you can compose a macro instead to enter that
information.
A macro is a little program saved to your spreadsheet, one that automatically executes a
set of Excel commands at your instruction and thus spares you the need to execute
them. At the click of a mouse or the tap of a keyboard shortcut, the commands play
themselves out—and do so far more swiftly than you could type or click them.
For example, you may have put together a custom list (see Chapter 2) of your business
clients, and if you’re doing well, the list may be lengthy. A macro can copy that list into
your workbook in a flash, without asking you to drag that fill handle down 50 rows worth
of names. Or perhaps you want to be able to apply a set of formatting changes to a
range. A macro can handle that assignment pronto, too.
The Two Kinds of Macros
A macro can be constructed in one of two ways. One is to put it together by deploying
the Visual Basic for Applications (VBA) programming language built into Excel, a method
that can let you build highly complex sequences of commands, including actions you
can’t execute through Excel’s standard complement of buttons. But breathe easy—
we’re not going to turn you into a VBA honcho here (though you’ll be happy to know that
the Apress catalog lists several books on just this subject if you want to learn more
about it).
The other approach—which is whole lot easier—is to activate the macro-recording
process, and then simply execute the commands you want the macro to play back, just
323
 
Search JabSto ::




Custom Search