10
Macros
M
any regular users of Excel nd that they are often
repeating the same series of spreadsheet tasks through
several mouse clicks and/or keystrokes. If you become
such a user, you may want to save on keystrokes or mouse clicks
through the macro feature of Excel. Furthermore, you may nd
that Excel—despite having several hundred built-in functions—does
not have a function that matches your specific needs for a project
and you may want to create one using Visual Basic for Applications
(VBA), a programming language designed exclusively to be used
with Excel and other Microsoft Office applications.
In this chapter we look at how to create macros by recording and
how to run them via buttons and graphic objects. We also introduce
and add the Developer tab to the Ribbon so that we can work with
Visual Basic Editor to perform editing of macros already recorded. The
Visual Basic Editor is used to create and modify programs in VBA
that will be discussed in the following chapters.
Macros
A macro is an automated series of Excel steps that can be executed through a single
command. The series of steps may be as simple as selecting a range of cells and
formatting them in terms of font and background color or it may be complex enough
to involve some arithmetic and logical manipulation of information in certain cells.
The advantage of using macros for repetitive tasks in Excel is that a task can be
executed through a single macro command.

Get Computing with Excel and VBA now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.