In this article you will be learning about VBA, the Visual Basic Application Editor in Excel, its uses, and a Hello World program using VBA.
What is VBA in Excel?
Microsoft Visual Basic for Applications (VBA) enables non-coders to record, create, and edit macros that can automate tasks in Office applications. Excel’s Visual Basic for Applications editor is a tool that enables you to write and edit custom scripts that automate actions in Excel.
What is the use of VBA in Excel?
VBA is used on the following things:
- Inserting a text string
- Automating a task you perform frequently
- Automating repetitive operations
- Creating a custom command
- Creating a custom toolbar button
- Creating a custom menu command
- Creating a simplified front end
- Developing new worksheet functions
- Creating complete, macro-driven applications.
- Creating custom add-ins for Excel
How to Enable the Developer Tab to use VBA?
To enable the Developer Tab, follow the below steps
- Under the “FILE” menu tab, Select “Options.”
- In the new window, Click on Customize Ribbon
- Check the Developer option
- Click on OK button
Now, you can see the Developer tab in the ribbon.
Hello World Application using VBA
To run a program for printing Hello World using VBA, follow these steps.
- Under the Developer tab, click Visual basic
- Select ‘Module’ from the Insert Menu
Enter the following code in the tab
Sub Helloworld() MsgBox "Hello World!" End Sub
Save it and press the run button.
You can see the text box with the hello world message popping up on your excel home screen.