Create Command Button and Apply Macro In Excel With Steps Details

In Excel there is an option by using that you can automate tasks in excel by just using Excel VBA. In Excel VBA by writing a macros you can achieve the result.

In this article i will show you the steps to write a simple macro which i will execute just after click on a command button.

Follow the following steps:

Enable Developer tab in Excel. 
1. Right click anywhere in Ribbon and then you get an option Customize ribbon,click on Customize Ribbon.

2. After it Excel Option Window will open in this right area window select Main tab and Check Developer Option in List and click OK.


3. You will find Developer tab next to View Tab.


Steps To Add Command Button In Worksheet
1. Select Developer tab and click on Insert, you will get list option to insert then select Command Button.


Steps To Assign Macro To Button
1. Select Design Mode Next to Insert in Developer Tab, before right click on Button. After right click you will get an option of View Code click on that Visual Basic Editor will open.



2. Place your cursor between Private Sub CommandButton1_Click() and End Sub,As i am inserting code to Print Hello on Click of this button.

3. Close The Visual basic Editor and deselect Design Editor in Developer tab.

4.Click On Button and Then Hello will print on sheet.


Hope this article will help you.