Excecl VBA Classic Excel VBA 2010 Excel VBA 365 Excel VBA Examples About Us

Lesson 1 Introduction


Microsoft 2010 Excel looks similar to Microsoft Excel 2007 but both are considerably different from Microsoft Excel 2003. MS Excel 2010 employs interactive ribbon controls for the menu bar instead of the old menu structure. Fortunately, the Visual Basic Editor (VBE) remains largely the same as that of version 2003

However, finding the active-x controls on the ribbon control is not as obvious as in Microsoft Excel 2003. You need to locate the Developer tab and click on it to launch the Excel 2010 VBA project window, as shown in Figure 1.1.

Figure 1.1

Sometimes the Developer tab is not shown on the menu bar. What should you do then? You have to open the Excel Options dialog by clicking File and then select options. The Excel Options dialog is as shown in Figure 1.2:

Figure 1.2

In the Excel Options window, select customize ribbons and you can see the following dialog box, make sure you check the Developer option, as shown in Figure 1.3:

Figure 1.3 Excel Options

After clicking on the Developer tab, you will be presented with the Developer window when you can have access to the Excel 2010 VBA editor as well as recording macros and more, as shown below:

Figure 1.4 The developer window

Clicking on View Code will launch the Excel 2010 VBA Editor Code Window.

Figure 1.5 The Excel 2010 VBA Editor

Now select Sheet1 in the VBA objects explorer window on the far left and the Book1-Sheet1 windows appears. Enter the following statements in the sheet 1 code window:

 Private Sub Worksheet_Activate()
 MsgBox "Welcome to Excel VBA 2010"
End Sub
 

As shown in Figure 1.6

Figure 1.6

Whenever the user clicks on worksheet 1, the following message box will pop out:

Figure 1.7



Copyright ® 2008 Dr.Liew Voon Kiong . All rights reserved   [Privacy Policy]

Contact: Facebook Page