How to Add a VBA Button in Excel? (2024)

Add the Form Control button, ActiveX Control button, and Excel Shapes to worksheets

Over 2 million + professionals use CFI to learn accounting, financial analysis, modeling and more. Unlock the essentials of corporate finance with our free resources and get an exclusive sneak peek at the first module of each course. Start Free

When using a workbook that incorporates VBA code, you can add a macro button to make it easier for other Excel users to run the code without knowing the VBA code. Excel users use such buttons to access most of the macros in the worksheet easily.

How to Add a VBA Button in Excel? (1)

Adding buttons to the worksheet will help expose other users to the custom functionality of your workbook. When a VBA button is clicked, it automatically activates a macro, and it eliminates the need to use the Developer tab to create or access macros.

Types of VBA Buttons for Worksheets

1. Form Control Buttons

Form control is one of the main ways of creating a button that runs a macro when a user clicks on it. It works in the same way as ActiveX control buttons, but they differ in several aspects.

Form control buttons give the impression of being pressed when a user clicks on them, and their appearance resembles buttons used in older versions of MS Windows. The buttons allow users to change the type, size, and color of the font. However, the button color cannot be changed.

Follow the following steps to create a Form Control Button:

  1. Go to the Developer tab and click Insert under the Control section.
  2. Click the Insert button in the drop-down list that opens.
  3. Position your cursor in the worksheet location where you want the button to be created.
  4. A pop-up window will appear. Click Assign Macro and confirm.
  5. Once the button is created, right-click on it, and click Form Control. It enables you to manage the button’s properties.

To change the button label, right-click on the button and select Edit Text from the drop-down list. You can also re-assign the macro by clicking the Assign Macro option from the drop-down list.

2. ActiveX Control Button

ActiveX Control buttons are the best alternative to Form Control buttons, and they allow more formatting options than the latter. When creating buttons using ActiveX, users are required to add the event macro to the sheet model. The macro will be triggered when the macro is clicked.

ActiveX Control buttons also allow users to add other event triggers, such as double-click. It lets users perform additional actions when the button is double-clicked.

Follow the below steps to create an ActiveX Control Button:

  1. Open the Developer tab and go to the Control section. Click Insert and scroll to the ActiveX controls.
  2. Click the first button below the ActiveX controls (Command button).
  3. Position your cursor on the worksheet location where you want your button to appear.
  4. To create the macro, click View Code in the Controls group under the Developer tab to launch the VBA editor. Choose CommandButton1 on the subprocedure (on the left). Press Click on the drop-down list on the right side of the VBA editor window.
  5. In the subprocedure, enter the name of an existing macro or create your own VBA code. You can find existing macros in the workbook by clicking Macros in the Code section. You can add multiple macros by entering the name of each macro on separate lines in the VBA editor.
  6. Click the Design mode to turn it off and close the VBA editor before running the VBA code. Then, create the ActiveX button create in the worksheet to run the macro.
  7. To change the button properties, click the Properties option under the Controls group section. Alternatively, right-click on the button and select Properties in the dropdown.

3. Excel Shapes

Apart from creating buttons from the Developer tab, Excel users can use Excel Shapes to create the buttons. The advantage of using Excel Shapes over Form Control buttons or ActiveX Control buttons is that shapes allow the most formatting and styling options. You can change button color, design, and font to make the buttons look modern.

Here are the steps to create a button in Excel using Excel Shapes:

  1. Click on the Insert tab and then click on Shapes.
  2. Select the preferred shape of your button (we selected a rounded rectangle).
  3. Drag and drop the selected shape to the preferred location on the worksheet to set the size of the shape.
  4. Right-click on the button and select Edit Text to change the button label. You can also format the button using the tools available under the Home tab.
  5. To specify a macro, right-click on the button and select Assign Macro.
  6. Select the macro from This Workbook list to make the macros shareable with other users who use the workbook. Press OK to confirm the macro.
  7. Click the button to trigger the macro operation.

Additional Resources

Through business intelligence and data analysis courses, training, and exercises, anyone in the world can become a great analyst. To keep advancing your career, the additional CFI resources below will be useful:

  • Excel VBA Examples
  • VBA in Excel
  • VBA Quick Reference
  • Top 8 VBA Routines for Excel Reporting
  • Transitioning from Excel to Python
  • See all Excel resources
How to Add a VBA Button in Excel? (2024)
Top Articles
Fixed Income Investment - Amsterdam Institute of Finance
Understanding Fixed Income & Bonds
Automated refuse, recycling for most residences; schedule announced | Lehigh Valley Press
Blorg Body Pillow
Winston Salem Nc Craigslist
Obor Guide Osrs
Online Reading Resources for Students & Teachers | Raz-Kids
Voordelige mode in topkwaliteit shoppen
Otterbrook Goldens
Jennette Mccurdy And Joe Tmz Photos
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
Geometry Escape Challenge A Answer Key
A Fashion Lover's Guide To Copenhagen
Iron Drop Cafe
104 Presidential Ct Lafayette La 70503
Hmr Properties
7440 Dean Martin Dr Suite 204 Directions
Gma Deals And Steals Today 2022
Google Feud Unblocked 6969
How Much Are Tb Tests At Cvs
Scenes from Paradise: Where to Visit Filming Locations Around the World - Paradise
Kitty Piggy Ssbbw
Eva Mastromatteo Erie Pa
Obsidian Guard's Cutlass
Red Devil 9664D Snowblower Manual
Lonesome Valley Barber
How pharmacies can help
Energy Healing Conference Utah
Pjs Obits
Azur Lane High Efficiency Combat Logistics Plan
2011 Hyundai Sonata 2 4 Serpentine Belt Diagram
208000 Yen To Usd
Gma' Deals & Steals Today
Skidware Project Mugetsu
Craftybase Coupon
Where to eat: the 50 best restaurants in Freiburg im Breisgau
UAE 2023 F&B Data Insights: Restaurant Population and Traffic Data
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
What Is Xfinity and How Is It Different from Comcast?
Solve 100000div3= | Microsoft Math Solver
Maybe Meant To Be Chapter 43
The TBM 930 Is Another Daher Masterpiece
11301 Lakeline Blvd Parkline Plaza Ctr Ste 150
Tyler Perry Marriage Counselor Play 123Movies
Rush Copley Swim Lessons
Uc Davis Tech Management Minor
Hampton In And Suites Near Me
877-552-2666
Learn4Good Job Posting
SF bay area cars & trucks "chevrolet 50" - craigslist
Sams La Habra Gas Price
Escape From Tarkov Supply Plans Therapist Quest Guide
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 5621

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.