Chapter 19: Understanding Excel s Events


image from book  Download CD Content

Overview

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 will 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 an object named CommandButton1 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 recognizes:

  • A workbook is opened or closed.

  • A window is activated.

  • A worksheet is activated or deactivated.

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

  • A workbook is about to be saved.

  • A workbook is about to be printed.

  • A worksheet is calculated.

  • An object is clicked.

  • The data in a chart is updated.

  • A particular key or key combination is pressed.

  • A particular time of day occurs.




Excel 2007 Power Programming with VBA
Excel 2007 Power Programming with VBA (Mr. Spreadsheets Bookshelf)
ISBN: 0470044012
EAN: 2147483647
Year: 2007
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net