How to insert an Excel command button (Macros)

in #excel6 years ago

Excel Command button guide – ActiveX Control – Microsoft Excel

In this guide we will outline how you can insert a Macro button in Excel. This Excel command button will be what you use to execute your macro/VBA code when you want to run your macro and is a handy and visual solution. The button looks like the image below.

command button.png

To insert a button into Microsoft Excel you may need to follow some of my other guides if this is brand new to you. I suggest the following 2 guides to get you started if you have not worked with macros or VBA code before. This first one is a must as you will need to enable the “Developer Tab” before you can proceed.

https://steemit.com/excel/@twoperscent/tutorial-how-to-enable-excel-macros

Excel VBA command button guide

To insert a command button, first of all open up your copy of Excel. From there navigate to the Developer Tab at the top of the ribbon.

command button 1.png

From here to Insert your Excel Command Button you will need to press the Insert button in the developer options, this will open up a small sub menu.

command button 2.png

To insert your button, press the top left gray rectangle under ActiveX controls. When this is selected your cursor will change into a cross. On your spreadsheet drag a box/rectangle shape, whatever size and shape you wish your Macro button to be (this can be moved and changed at a later time so don’t worry too much if it’s not perfect just now) and release the mouse. You will see your Excel Command Button has appeared.
To program your Excel command button with VBA code, press design mode under the developer options so that it appears clicked in.

command button 3.png

If you then double click your button the following box should appear.

command button 4.png

This is where you will enter your macro code that is attributed to this button. When this button is clicked when out of design mode, whatever code you insert into this dialogue box will attempt to be executed. When modifying and creating your own macros you will need to follow this step to insert your own code for your own workbooks.

This concludes our Excel command button tutorial.

I hope that this guide has helped you, please like and subscribe if so for more tutorials.
Twoperscent

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
http://twoperscent.com/index.php/2017/02/07/excel-command-button-guide-activex-control/

Yep...thats also my website :) Thanks for linking Mr Robot