Chapter Summary

Well, I didn't show you very much program code in this chapter, but you did get a solid introduction to the VBA programming environment. You did learn how to access the VBA IDE and how to view and use some of its major components. You also learned how to add ActiveX controls to a worksheet, change their properties, and add code to their event procedures.

After a brief look at using the on-line help and installing the VBA help files, you developed a small project that used a Command Button control on a worksheet to initiate a program that calculated statistical values from user-selected data. Your program then formatted the output with color, a new font, and a border.

In Chapter 2 you learn about some basic programming concepts and tools, variables and data types. I focus particularly on the string data type.


1. Open a new workbook in Excel, then access the VBA IDE to find the names of the different event procedures for a worksheet. In particular note the SelectionChange() event procedure of any worksheet.

2. While in the Excel application, add a Label control to a worksheet. Change the Name property of the Label control to lblCellAddress. Change the Caption and other appearance properties (Font, BackColor, ForeColor, and so on) as desired.

3. Add the following line of code to the SelectionChange() event procedure of the worksheet to which you added the Label control.

lblCellAddress.Caption = "You selected cell " & Target.Address

4. Return to the worksheet, exit Design Mode, and click on any cell in the worksheet containing the Label control. What happens?

5. Return to the VBA IDE and the line of code above. Place the cursor within the word Caption and press F1. Repeat with the Address keyword.

This page intentionally left blank


Was this article helpful?

0 0
Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook

Post a comment