Forum Discussion

Scott Stilwell's avatar
Scott Stilwell
Copper Contributor
Feb 23, 2018

Macro execution

How do I attach a macro to a button so the user merely has to click the button to execute the macro?

2 Replies

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Scott,

      

    First, you have to enable the https://support.office.com/en-us/article/show-the-developer-tab-e1192344-5e56-4d45-931b-e5fd9bea2d45, then go to:

    Developer >> Controls >> Insert

     

    From the Form Controls group, select Button (Form Control) which is located in the left-hand corner, and drop it to the worksheet!

     

    After that, the Assign Macro dialog box will automatically appear so that you select any existing macro and assign it to the button!

     

    If you miss this dialog box, you can right-click on the button, and select Assign Macro.

     

  • Damien_Rosario's avatar
    Damien_Rosario
    Silver Contributor

    Hi Scott

     

    Try this:

     

    1. In the Developer menu tab, click onto Insert and add the click onto the very first icon in the list, top left.

     

    Note: If you don't have it then right click onto the View menu text, Customize the ribbon and add Developer.

     

    2. Drag and make the button the size you want. When you do an Assign Macro box will appear asking you to name the Macro name.

     

    3. You can also click onto New button which will open VBA code window for you to put code against, or Record so you can make a macro based on your actions.

    Hope that helps?

     

    Cheers

    Damien

Resources