20 July 2014

Create your first macro in Excel - VBA

Introduction :


 In this post, I will show you how to create your first macro (VBA program).

Objective :


To create a Macro which will show a Message Box "HELLO WORLD" (world classic "Hello World!" example J)

To write your 1st program and enter into world of VBA, follow the below steps

Steps :


1. Open Excel, and press Alt+F11 (this will open a new window Visual Basic Editor)

2. Click on INSERT >> MODULE



3. Then in the right side window type the below Code
      
      Sub MyFirstMacro()
           Msgbox "Hello World"
      End Sub 

       

4. Then Press the F5 button to Execute(You can also click the Button)

You will see a message box saying "Hello World"You can type whatever you want to see in the message box
we should save the file in .xlsm or .xlsb file extension, so that we can run the macro later


                                        !********************* Try it out J ***************************!

Reference : Microsoft Excel Tutorials - Daily updates (Facebook page)


No comments:

Post a Comment