Datasheet

Introducing
Macros
Y
ou can use macros to automate many of the tasks
you perform in Excel. For example, if you
frequently format your data in a particular way,
you can use Excel’s macro recorder to record the steps
you use to format your data. You can then play back the
recorded steps whenever you want to apply your format.
Any series of commands you can execute in Excel, you
can also record and play back.
The commands you use to create and execute macros are
located on the Developer tab. By default, the Developer
tab does not display in Excel. To display it, you must
choose the Show Developer Tab in the Ribbon option in
the Excel Options dialog box.
You begin recording macros by clicking Record Macro on
the Developer tab or by clicking the Record Macro button
on the status bar. Both commands open the Record Macro
dialog box. For detailed instructions on how to use the
Record Macro dialog box, see the section, “Record a
Macro.”
When you record a macro, you can record it using an
absolute reference or a relative reference. If you record
using an absolute reference, when Excel plays back your
macro, it plays back the exact cells you clicked when you
recorded the macro. If you record using a relative
reference, Excel plays back the relative location of the
cells you used when you recorded your macro. Click the
Use Relative References button on the Developer tab to
record using a relative reference. To learn more about
absolute and relative references, see the section, “Record
a Macro.”
When you save a workbook that has macros, you must
save it as a macro-enabled workbook. Excel gives macro-
enabled workbooks an .xlsm file extension.
SHOW THE DEVELOPER TAB
1 Click Customize Quick Access Toolbar and then click More
Commands.
The Excel Options dialog box appears.
2 Click Popular.
3 Click Show Developer Tab in the Ribbon ( changes to ).
4 Click OK.
The Developer tab appears in the Ribbon.
Click to record a macro.
Click to record with a relative reference.
Click to change macro security.
Click to run macros.
Click to open the Visual Basic Editor.
1
1
3
2
4
Introducing Macros
4
04_132302 ch01.qxp 7/27/07 9:19 PM Page 4