VBA stands for Visual Basic for Applications. Excel VBA is Microsoft’s programming language for Excel and other Microsoft Office programs.

Show the VBA Developer tab

With the Excel file opened, go to File -> Options -> Customize Ribbon -> Main Tabs -> check the Developer checkbox -> OK

Open the VBA Editor

To open the VBA Editor, we can either press Alt + F11 or click on the Developer tab -> Visual Basic

Display a Hello World message

If you are on the VBA Editor, press Alt + F11 to go back to the Excel window. Click on Developer -> Insert -> Button

Name the macro “hello” -> choose Macro in “This Workbook” -> click on the New button

Key in the code MsgBox (“Hello World, VBA”) in the hello() method

press Alt + F11 to go back to the Excel window. Rename the button to “Say Hello” and click on it. The message “Hello World, VBA!” should be displayed as the below screenshot.

Save as an xlsm file

We need to save the workbook as an Excel Macro-Enabled Workbook.

Open the Debug window

In the Visual Basic editor, press Ctrl + G

Print debug messages

To print a debug message, use Debug.Print followed by the message. For example: