We have seen how to record a macro in the previous topic, we will see how to write simple “Startup India” VBA macro. Follow the below steps to do this to show the “Startup India” message box to the user.
Hello World VBA- Writing Your First Macro –
Step 1: Open the VBA Editor (press Alt+F11)
Step 2: Select ‘Module’ from the Insert Menu
Step 3: Start a new procedure called ‘sbIndia’
To do this write the following line in the module.
And then press Enter. You should see the code as follows:
Sub sbIndia() End Sub
Step 4: This is called a sub procedure where you will write the code as per your requirement.
Our requirement is to show a message as “Startup India” to do this write following line in the procedure.
MsgBox "Startup India!" Now your procedure should look like this:
MsgBox "Startup India!"
Step 5: You are Done! Yes, now run your macro by pressing ‘F5’