Friday, January 30, 2009

VBA Macro Excel Tutorial: Creating Your First VBA Macro Excel

In this section, I will show you how to create your first VBA Macro Excel. In this example, we will create a "I Love Excel!" message box. To create the macro, please follow instructions bellow:

1. First step, open your visual basic editor by clicking Tools -> Macro -> Visual Basic Editor


2. Click Insert menu, and then select Module to open module window.


3. In the module window type following code:

Sub showHello()
   MsgBox "
I Love Excel!"
End Sub


4. To run your first macro, click Run -> Run Sub/UserForm or by pressing [F5] key.


5. "I Love Excel!" message box will appear in your screen.

No comments:

Post a Comment