Datasheet
25
Chapter 1: Using Macros and Form Controls
6
To assign a macro to a button, create the macro, and
then click the Developer tab. Click Insert in the Controls
group. A menu appears. Select the button control and
then click and drag to create a button. The Assign Macro
dialog box appears. Click the macro you want to assign
and then click OK. Right-click the button twice and then
click Edit Text on the menu that appears. Type the name
you want to give the button. You can now click the
button to execute the macro.
If you no longer want a macro to be assigned to a control,
you can right-click the control twice and then click the
Assign Macro option. In the Assign Macro dialog box,
delete the macro name from the Macro Name field and
then click OK. Excel removes the macro assignment from
the control, but the macro remains as part of the
workbook. To remove the macro from the workbook,
click the View tab. Click Macros in the Macros group.
Click View Macros. The Macro dialog box appears. Select
the macro you want and then click Delete.
Excel executes the associated macro.
•
In the example, Excel assigns postage
to the invoice.
6 Click the control with the
assigned macro.
03_591598-ch01.indd 2503_591598-ch01.indd 25 6/11/10 1:41 PM6/11/10 1:41 PM