Getting started with VBA in Excel 2007

 

  • Go to Start Menu –> Programs –> Microsoft Office –> Microsoft Office Excel 2007.
  • Once the windows for excel application is opened. Click image  and click button Excel Options as below.

image

  • Under Popular menu, tick “Show Developer tab in the Ribbon” as shown below to enable developer tab and then click OK.

image

  • Developer tab is shown as below.

image

  • Click the “Developer tab” to see the sub menu and then click Visual Basic. This is the VBA.

image

  • 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.

image

  • To create a form, go to menu Insert and click “UserForm”.

image

  • You can see the UserForm1 and Toolbox windows as shown below.

image

  • 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.

image

  • 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.

image

  • From the UserForm1 windows, click on CommandButton1 you have created earlier and you will see a message box displaying “Hello World”. Congratulation !!!

image

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Loading...
 
 
 

Total Pageviews

Advertisements