![](https://adglob.in/blog/wp-content/uploads/2021/10/Visual-Basic-for-Applications-1024x512.jpg)
In this chapter, you will learn how to write a simple macro in a step-by-step manner.
Step 1 β First, enable ‘Developer’ menu in Excel 20XX. To do the same, click File β Options.
Step 2 β Click βCustomize the Ribbonβ tab and check ‘Developer’. Click ‘OK’.
![macro](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_1.png)
Step3 β The ‘Developer’ ribbon appears in the menu bar.
![](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_2.png)
Step4 β Click the ‘Visual Basic’ button to open the VBA Editor.
![macro](https://adglob.in/blog/wp-content/uploads/2021/10/vba_module_1.png)
Step5 β Start scripting by adding a button. Click Insert β Select the button.
![](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_3.png)
Step6 β Perform a right-click and choose ‘properties’.
![](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_4.png)
Step7 β Edit the name and caption as shown in the following screenshot.
![macro](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_5.png)
Step8 β Now double-click the button and the sub-procedure outline will be displayed as shown in the following screenshot.
![](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_6.png)
Step9 β Start coding by simply adding a message.
Private Sub say_helloworld_Click() MsgBox "Hi" End Sub
Step10 β Click the button to execute the sub-procedure. The output of the sub-procedure is shown in the following screenshot. Make sure that you do have design mode turned on. Simply click it to turn it on if it is not on.
![](https://adglob.in/blog/wp-content/uploads/2021/10/excel_macro_7.png)
Note β In further chapters, we will demonstrate using a simple button, as explained from step#1 to 10. Hence , it is important to understand this chapter thoroughly.
Next Topic:-click here
Pingback: VBA - Excel Terms | Adglob Infosystem Pvt Ltd
Pingback: VBA - Overview - Adglob Infosystem Pvt Ltd