Elite Membership

Create Button Macro In Excel

Written by Jeevan A Y Jeevan A Y Freelance Writer Jeevan, a seasoned data expert with 7 years in MIS reporting, excels in Advanced Excel, VBA, Power BI, and SQL. Currently an Assistant Manager MIS, his insightful data storytelling drives swift decision-making. 7+ years of experience MBA (Finance & Marketing) MIS Reporting View Full Profile
Reviewed by Dheeraj Vaidya, CFA, FRM Dheeraj Vaidya, CFA, FRM Content Reviewer & Course Director A former J.P.Morgan and CLSA Equity Analyst, Dheeraj specializes in financial modeling, AI, forecasting, and valuations. In his career spanning almost two decades, he has trained and mentored more than 100,000 students and professionals on a range of topics. 20+ years of experience CFA, FRM, IIT Delhi, IIM Lucknow Financial Modeling View Full Profile
Updated May 2, 2025
Read Time 6 min

What Is Create A Macro Button In Excel?

Weย create a Macro button In Excel to assign it some Macro code and make it interactive, easy to access, and save time. Once the coding is complete, we execute the program to get the task done.

Download FREE Create Button Macro In Excel Template and Follow Along!
Download Excel Template

An interactive button can perform many activities in the worksheets. Therefore, once programming is done, we can assign that particular task to one of the buttons so that the given job will be executed by click of the button.

Excel-Create-Button

Key Takeaways

  • The Create Button Macro in Excel helps us save time while using macros or executing them.
  • We write a macro, save it. To execute the code each time, we must open it from the VBA Editor and press the Run command.
  • When we create a button and assign an existing macro to it, with just the click of that button, we can run the Macro code thereby avoiding the lengthy steps listed above.
  • We can create a button using any shapes available in the โ€œInsertโ€ tab, or the Form Controls or the ActiveX Control buttons from the โ€œDeveloperโ€ tab.

3 Methods To Create Button In Macro Excel

We can create a button in three methods in Excel, namely:

  1. Using Shapes.
  2. Using Active X.
  3. Form Control in Excel.

Examples

We will consider specific examples for the methods to Create Button Macro in Excel.

Example #1 – Using Shapes

Using the โ€œShapesโ€ feature in Excel, we can insert a wide variety of shapes, and also format them.

Before inserting shapes, below is the macro we had written to filter values in the below data.

Create Button Example 1

We have data in columns from A to E. In the cell G2, we have created a drop-down list of all the card types. The card type that we choose in cell G2 should be filtered out in the data. For this, below is the Excel macro code we have written.

Code:

Sub Filter_Values()ย 

Dim LRย Asย Longย 

Dim LCย Asย Longย 

Dim Rngย As Rangeย 

‘ Find the last row in column A

LR = Cells(Rows.Count, 1).End(xlUp).Rowย 

‘ Find the last column in row 5

LC = Cells(5, Columns.Count).End(xlToLeft).Columnย 

‘ Define the range starting from cell (5,1)

Set Rng = Cells(5, 1).Resize(LR, LC)ย 

‘ Apply AutoFilter on the 4th field based on G2 value

Rng.AutoFilter Field:=4, Criteria1:=Range(“G2”).Valueย 

End Sub

Upon running the above code, it will filter the values which are selected in the cell cell G2. Each time we must open the Visual Basic Editor, and run the code.

So, now we will insert shapes to assign the VBA macro.

Follow the below-given steps to assign macro to shape

  1. We must first go to the โ€œInsertโ€ tab in Excel and find the โ€œShapesโ€ option.


    Create Button Example 1-1

  2. Once we click on the โ€œShapesโ€ drop-down list, we see many shape options. Select any of the shapes and draw on the worksheet.


    Create Button Example 1-3

  3. After adding the shapes, we need to enter some text values, so right-click on the shape and choose โ€œEdit Text.โ€


    Create Button Example 1-4

  4. We must enter the text as we would like to convey the message to the user.


    Create Button Example 1-5

    It is the default view of the shape.

  5. We can format the shape under the โ€œFormatโ€ tab.


    Create Button Example 1-6

  6. Once the proper formatting is given to the shape, we need to click and choose โ€œAssign Macro.โ€


    Create Button Example 1-7

  7. Once the proper formatting is given to the shape, right-click and choose โ€œAssign Macro.โ€ Next, we must select the macro we want to assign to the shape.


    Create Button Example 1-9

  8. Now click โ€œOKโ€. Currently, the macro has been assigned to the shape.

We see the hand pointer indicating the click option when we hover on the shape. If we click, it will execute the assigned macro, and the value in cellย G2 will be filtered.

Create Button Example 1-11

Example #2 – Using Form Control Shapes & Active X

We will consider a combined example for the other 2 methods, Form Control Shapes & ActiveX.

Under theย Developer tab, we have an option called โ€œInsert.โ€ Under this, we have โ€œForm Controlโ€ and โ€œActiveX Control.โ€

Use Form Control 1

Fromย โ€œForm Controlsโ€, we will select theย โ€œButtonโ€ option.

Use Form Control 1-1

Then, draw this on the worksheet, and immediately we will get a list of macros.

Use Form Control 1-2

We must choose the macro we want to assign and click โ€œOK,โ€ to close the above window.

As a result, now, a button is created to run the macro.

Use Form Control 1-3

Like this, we can create a button in Excel to execute the macro.

To learn more in detail about VBA macros and use them for buttons, you can always go through ourย Basic and Advanced VBA Course to become an expert.ย 

Important Things To Note

  • The Active X Control button requires further coding knowledge, so not covered in this article.
  • The basic difference between โ€œShapeโ€ and โ€œForm Controlsโ€ is the formatting and style they look like.

Frequently Asked Questions (FAQs)

How to enable the Developer tab?

When we want to assign a button to the Macro Code, first, we must create Macros using the option available in the โ€œDeveloperโ€ Tab. Sometimes, the โ€œDeveloperโ€ Tab will not be available on the ribbon, if we havenโ€™t used it before. Therefore, we must first enable it.

The steps to enable the โ€œDeveloperโ€ tab are as follows:

  • Step 1: Go to the โ€œFileโ€ tab.

Create Button Macro FAQ 1

  • Step 2: Click the โ€œMoreโ€ฆโ€ option from the list โ†’ select the โ€œOptionsโ€.

Create Button Macro FAQ 1-1

  • Step 3:ย The โ€œExcel Optionsโ€ window pops up, and then click the โ€œCustomize Ribbonโ€ on the left side of the โ€œExcel Optionsโ€ window.

Create Button Macro FAQ 1-2

  • Step 4:ย Check the โ€œDeveloperโ€ tab checkbox under the โ€œMain Tabsโ€ย on the right side of the โ€œExcel Optionsโ€ window.

Create Button Macro FAQ 1-3

  • Step 5:ย Click โ€œOKโ€. Now, the โ€œDeveloperโ€ tab is enabled and appears on the ribbon, as shown below.

Create Button Macro FAQ 1-4

How to Add the Macro button to the Excel ribbon?

The steps to add the Macro button to the Excel Ribbon are as follows:

Step 1: Go to the โ€œFileโ€ tab.

Create Button Macro FAQ 2

  • Step 2: Click the โ€œMoreโ€ฆโ€ option from the list โ†’ select the โ€œOptionsโ€.

Create Button Macro FAQ 2-1

  • Step 3: The โ€œExcel Optionsโ€ window pops up.
    เงน First, click the โ€œQuick Access Toolbarโ€ on the left side of the โ€œExcel Optionsโ€ window.
    เงน Next, select the โ€œMacrosโ€ option from the โ€œChoose commands from:โ€ drop-down.

Create Button Macro FAQ 2-2

Immediately, the list of created and saved Macro files appears in the section below the โ€œChoose commands from:โ€ drop-down. We can select the requiredย Macro Code, and click โ€œOKโ€.

Finally, we can see the Macro button added to the Excel Ribbon.

The Create Button Macro in Excel is not working or is greyed out.

The Create Button Macro in Excelย may not work for the following reasons, namely,

  • The Macro Code file assigned is deleted and moved to another location.
  • The Button is assigned to a different file or not assigned at all.

Recommended Articles

This article has been a guide to Create Button Macro in Excel. Here we assign macro to buttons from shapes, ActiveX & Form Controls, examples & downloadable template. You may learn more about Excel from the following articles: –