Add a button and assign a macro to it

You can use a button (a form control) to run a macro (macro: An action or a set of actions that you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.) that performs an action when a user clicks it. For example, you might use a button to automate the printing of a worksheet, the filtering of data, or the calculation of numbers. The following procedure assumes that you've created a macro already.

  1. On the Developer tab, in the Forms Control group, click Button.

ShowIf the Developer tab is not available

  1. On the right side of the ribbon, click Action pop-up menu, and then click Ribbon Preferences.
  2. Under Customize, select the Developer check box.
  1. Click the worksheet location where you want the upper-left corner of the button to appear.
  2. To create the button, drag in the sheet.
  3. In the Assign Macro dialog box, click the name of the macro that you want to assign to the button, and then click OK.
  4. To specify the control properties of the button, hold down CONTROL and click the button, and then click Format Control.
  5. To test your button, click it. Your macro should run.

See also

Create, run, edit, or delete a macro

 
 
Applies to:
Excel for Mac 2011