- Go to Start Menu –> Programs –> Microsoft Office –> Microsoft Office Excel 2007.
- Under Popular menu, tick “Show Developer tab in the Ribbon” as shown below to enable developer tab and then click OK.
- Developer tab is shown as below.
- Click the “Developer tab” to see the sub menu and then click Visual Basic. This is the VBA.
- Once you click the visual basic icon above, another windows named “Microsoft Visual Basic – Book1” will be prompted out as shown below to start programming with VBA. You can also see VBAProject(Book1) under “Project” property windows.
- To create a form, go to menu Insert and click “UserForm”.
- You can see the UserForm1 and Toolbox windows as shown below.
- Look at toolbox under controls icons, click CommandBotton icon and click anywhere at UserForm1 and drag right-down to create a command button as shown below.
- Double click CommandButton1 and type the code in bold below.
Private Sub CommandButton1_Click()
MsgBox ("Hello World")
End Sub
- Click run to prompt out your first user form windows.
- From the UserForm1 windows, click on CommandButton1 you have created earlier and you will see a message box displaying “Hello World”. Congratulation !!!
0 comments:
Post a Comment