How to use a command button in an Excel worksheet
Use the tool box to insert a command button (ActiveX control) into your Microsoft Excel document and then provide the macro code to be executed when you click on it.
Open the tool box by clicking on ‘view’, selecting ‘toolbars’ and finally clicking on the ‘control toolbox’ item.
Click on the command button.
Now drag the mouse in the Microsoft Excel document at a position of your choice to draw the command button.
You can resize the command button by dragging along any of the 8 handles.
You can also change the caption, name, colour, size, etc of the button by right clicking, selecting properties and then appropriately modifying the properties in the properties window.
Double click on the command button to start the Visual Basic editor in Excel.
Now you can write your macro code for the button to execute when a user clicks on it after exiting the ‘design’ mode.
You can toggle between the ‘design’ and ‘execution’ mode by clicking on the ‘design mode’ icon on the control toolbox.
The following training video shows how to create the command button in Excel and add the relevant macro code.
Run a Macro from a Command Button