Understanding Excels Events

IN THIS CHAPTER

This chapter explains the concept of Excel events, and I include many examples that you can adapt to your own needs. As you can see, understanding events can give your Excel applications a powerful edge. Here you will find

♦ An overview of the types of events that Excel can monitor

♦ Essential background information for working with events

♦ Examples of Workbook events, Worksheet events, Chart events, and UserForm events

♦ Using Application events to monitor all open workbooks

♦ Examples of processing time-based events and keystroke events

In several earlier chapters in this book, I present examples of VBA event handler procedures, which are specially named procedures that are executed when a specific event occurs. A simple example is the CommandButton1_Click procedure that is executed when the user clicks a CommandButton stored on a UserForm or on a worksheet.

Excel is capable of monitoring a wide variety of events, and executing your VBA code when a particular event occurs. Following are just a few examples of the types of events that Excel can recognize:

♦ A workbook is opened or closed.

♦ A worksheet is activated or deactivated.

♦ Data is entered into a cell or the cell is edited.

♦ A worksheet is calculated.

♦ A particular key or key combination is pressed.

♦ A particular time of day occurs.

0 0

Post a comment