Monday, December 26, 2016

Add a button and assign a macro to it

Add a button and assign a macro to it

You can use a button (a form control) to run a macro 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.

    If 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.

  2. Click the worksheet location where you want the upper-left corner of the button to appear.

  3. To create the button, drag in the sheet.

  4. In the Assign Macro dialog box, click the name of the macro that you want to assign to the button, and then click OK.

  5. To specify the control properties of the button, hold down CONTROL and click the button, and then click Format Control.

  6. To test your button, click it. Your macro should run.

See also

Create, run, edit, or delete a macro

No comments:

Post a Comment