Hello VBA World!
Ok so we have learned how to record a Macro and we discussed couple of examples where we recorded the macros. As we discussed in our earlier blog that for modifying our recorded Macros or to write our own Macro from beginning we need to use VBA Editor.
Now lets write a very simple VBA code to just display a message to the user. Yeah it is compulsory to have a Hello World! Program in all the Programming Books. So here it is.
1. Create a new Module as explained earlier.
2. Type sub Hello_World and press Enter.
3. Press Tab, type msgbox "Hello VBA World!", and press Enter.
4. Press CTRL + S to save the Module. After completing these steps your Macro would appear as below.
Sub Hello_World() MsgBox "Hello VBA World!" End Sub
Run this Macro and be amazed.
1. Go back to the Excel Sheet
2. Press ALT + F8
3. Select "Hello_World" and press Run button When you run this Macro "Hello VBA World!" will be displayed on the screen. Congratulations! you have written and executed your first Excel VBA Macro.
If you like this post then why don't you subscribe to our mailing list to get the latest post right in your mail box.