158
Part III: Programming Concepts Most Excel programmers never need to worry about most of the events in this list. You should, however, at least know that these events exist because they may come in handy someday. In this chapter, I discuss the most commonly used events. To simplify things, I talk about two types of events: workbook and worksheet. Table 11-1 lists most of the workbook-related events. You can access the complete list if you follow these directions: 1. Choose the ThisWorkbook object in the Project window. 2. Display the Code window. Choose View➪Code or press F7 to do this. 3. Choose the Workbook object in the Object drop-down list (at the top left of the Code window). 4. Expand the Procedure drop-down list (at the top right of the Code window).
Table 11-1
Workbook Events
Event
When It’s Triggered
Activate
The workbook is activated.
AddinInstall
An add-in is installed (relevant only for add-ins).
AddinUninstall
The add-in is uninstalled (relevant only for add-ins).
BeforeClose
The workbook is closed.
BeforePrint
The workbook is printed.
BeforeSave
The workbook is saved.
Deactivate
The workbook is deactivated.
NewSheet
A new sheet is added to the workbook.
Open
The workbook is opened.
SheetActivate
A sheet in the workbook is activated.
SheetBefore DoubleClick
A cell in the workbook is double-clicked.
SheetBefore RightClick
A cell in the workbook is right-clicked.
SheetCalculate
A sheet in the workbook is recalculated.
SheetChange
A change is made to a cell in the workbook.
SheetDeactivate
A sheet in the workbook is deactivated.