3 Easy Methods to Create Button in Excel for Macros (2024)

Do you repeat various Excel actions like copy & pasting data, formatting, putting borders, etc?

Do you know that you create button in Excel and automate your tasks in Excel with a couple of mouse clicks?

If you keep on repeating the same thing over and over again,creating anExcel Macrois perfect for you! It saves you time so you can do things that you like doing, like going home early 🙂

Click a button and all your tasks are done for you!

I will show you 3 different ways using which you can enable the Macro Creation and create button in Excel!

Watch our free training video on How to Create Your First Macro Button in Excel

Table of Contents

  • Using ActiveX Control Buttons
  • Using Shapes
  • Add to Quick Access Toolbar

Follow a step-by-step tutorial on how to create a button in Excel and download this Excel workbook to follow along:

DOWNLOAD EXCEL WORKBOOK

Using ActiveX Control Buttons

Running a macro can sometimes be a tedious task. The fastest way to run a macro will be to assign a macro to a button. You can use ActiveX controls to create button in Excel.

STEP 1: Right-click anywhere on your Ribbon and selectCustomize the Ribbon:

STEP 2:Make sure theCustomize Ribbonis selected.

Then select theDeveloperoption underMain Tabs.

ClickOK.

STEP 3:Now go toDeveloper > Insert > ActiveX Controls > Button

Drag anywhere in the Excel spreadsheet to create button in Excel.

See also Understanding the VBA MsgBox Function: A Comprehensive Guide

STEP 4: Right-click on your new button and selectView Code.

STEP 5:Type in this code:Range(“A6”).Value = “Hello”

What this will do is toset the value of cell A6 toHello.

STEP 6:Time to test it out! Make sureDesign Mode is deselected.

STEP 7:Click on the button now and you will seeHellopop up on your screen!

In this way, you can create button in Excel and assign a macro to it. Using VBA codes, you can also assign a different task for a different trigger like double-click single-click, right-click, etc.

You can even change the formatting of this button by right-clicking on the button and selecting the option Format Control.

But the only issue with this method is that the size of the button may change when you make changes to the worksheet or share it with someone else.

Using Shapes

Shapes provide you the flexibility to format and customize the appearance of the buttons on your Excel spreadsheet.

You can use different shapes, icons, WordArt images, and objects as per the theme of your worksheet. The formatting will also remain consistent using this method.

In my opinion, this is the simplest and most adaptable option to create button in Excel and run a macro.

Let’s look at a detailed tutorial on how we can go about this:

STEP 1: Go to Insert Tab > Select Illustrations > Under shapes dropdown > Select rectangle shape.

STEP 2:Right-click the shape and select Edit Text to add text to the button.

Or, you can double click on the button to edit text.

STEP 3: Provide a name to this button – Highlight Max Value.

STEP 4: Go to Developer >Visual Basic.

STEP 5: Type the following code in the module.

Copy Source Code:

<em>Sub HighlightMaxValue()</em><em>Dim cell As Range</em><em>For Each cell In Selection</em><em>'If it matches the highest value, then change the style to be Note</em><em>If cell = WorksheetFunction.Max(Selection) Then</em><em>cell.Style = "Note"</em><em>End If</em><em>Next cell</em><em>End Sub</em>

HighlightMaxValue will now be saved!

STEP 6: You can easily add a macro to this button by right-clicking on the button and select Assign Macro.

STEP 7: In the Assign Macro dialog box, you can select one macro (here, HighlightMaxValue) from the list saved in the Excel Workbook. Click OK.

This HighlightMaxValue will highlight the cell with maximum value with yellow color.

STEP 8: Select the range and then press the Excel Macro button.

STEP 9: Select the maximum value from the range i.e. 947 will be highlighted.

This is how you can easily use shapes to create button in Excel and assign a macro to it.

See also How to Insert Multiple Rows Using Macros in Excel

You can also customize these buttons by following the steps below:

  • Hold the Ctrl key and click on the button.
  • Go to Shape Format Tab
  • Select an appropriate option from the list – shape fill, shape outline, shape effects, text fill, text outline, text effects, size, etc.

To provide the button a 3-D effect – Go to Shape Format > Shape Effects > Bevel > Round.

This is how your 3-D Excel Macro button will look like:

You can also prevent these buttons from changing their size when you change the size of a column or row.

  • Right-click on the button and select Size and Properties.
  • In the Format Shape dialog box, go to Properties and select Don’t move or size with cells.

Now, even if you change the size of the rows or columns, the button will remain intact.

Add to Quick Access Toolbar

You can easily add a macro as a button on the Quick Access Toolbar and use it on any of the sheets present in the workbook.

STEP 1: Right-click on the arrow next to the Quick Access Toolbar and select More Commands.

STEP 2: In the Choose commands fromlist, selectMacros.

STEP 3: Select HighlightMaxValue from the list and click on Add>>.

STEP 4: Click on Modify to change the symbol of this macro.

See also Microsoft Excel Online Course Private Access - 20+ Hours Beginner to Advanced Course

STEP 5: Select an appropriate symbol and click OK.

STEP 6: Click OK.

Your Quick Access Toolbar will now contain the macro – HighlightMaxValue. Simply, click on this icon and your macro will run!

Further Learning:

  • 3 Easy Methods to Create Button in Excel for Macros
  • 101 Excel Macros Examples
  • Reverse Text Function Using Macros In Excel

Make sure to download our FREE PDF on the 333 Excel keyboard Shortcuts here:

3 Easy Methods to Create Button in Excel for Macros (32)

You can learn more about how to use Excel by viewing our FREE Excel webinar training on Formulas, Pivot Tables, Power Query, and !

Post Views: 36,987

3 Easy Methods to Create Button in Excel for Macros (34)

Bryan

Bryan is a best-selling book author of the 101 Excel Series paperback books.

3 Easy Methods to Create Button in Excel for Macros (2024)
Top Articles
Latest Posts
Article information

Author: Duncan Muller

Last Updated:

Views: 6048

Rating: 4.9 / 5 (59 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Duncan Muller

Birthday: 1997-01-13

Address: Apt. 505 914 Phillip Crossroad, O'Konborough, NV 62411

Phone: +8555305800947

Job: Construction Agent

Hobby: Shopping, Table tennis, Snowboarding, Rafting, Motor sports, Homebrewing, Taxidermy

Introduction: My name is Duncan Muller, I am a enchanting, good, gentle, modern, tasty, nice, elegant person who loves writing and wants to share my knowledge and understanding with you.