REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

We have seen how to record a macro in the previous topic, we will see how to write simple Hello World VBA macro. Follow the below steps to do this to show the “Hello World!” message box to the user.

Hello World VBA- Writing Your First Macro – Step 1: Open the VBA Editor (press Alt+F11)

Hello World VBA- Writing Your First Macro

Hello World VBA- Writing Your First Macro – Step 2: Select ‘Module’ from the Insert Menu

Hello World VBA- Writing Your First Macro

Hello World VBA- Writing Your First Macro – Step 3: Start a new procedure called ‘sbHellow’

To do this write the following line in the module.

Sub sbHello()

And then press Enter. You should see the code as follows:

Sub sbHello()

End Sub
Hello World VBA- Writing Your First Macro – 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 “Hello World!” to do this write following line in the procedure.

MsgBox "Hello World!"

Now your procedure should look like this:
Hello World VBA- Writing Your First Macro

Sub sbHello()
MsgBox "Hello World!"
End Sub
Hello World VBA- Writing Your First Macro – Step 5: You are Done! Yes, now run your macro by pressing ‘F5’

You should see Hello World! message box as shown below:
Hello World VBA- Writing Your First Macro

Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: Excel VBATags: Last Updated: June 17, 2022

Leave A Comment