Worksheet Events

The worksheet-related events are shown in Table 11-1. These events are also referred to as document events.

Table 11-1. Worksheet Events (DocEvents)

Event name

Description

Activate

Occurs when a worksheet is activated.

BeforeDoubleClick

Occurs when a worksheet is double-clicked, before the default double-click action.

BeforeRightClick

Occurs when a worksheet is right-clicked, before the default right-click action.

Calculate

Occurs after the worksheet is recalculated.

Change

Occurs when cells on the worksheet are changed by the user or by an external link.

Deactivate

Occurs when the worksheet is deactivated.

PivotTableUpdate (Excel 10 only)

Occurs after a PivotTable report is updated on a worksheet.

SelectionChange

Occurs when the selection changes on a worksheet.

11.5 WorkBook Events

Table 11-2 shows the workbook-related events.

Table 11-2. Workbook Events

Event name

Description

Activate

Occurs when a workbook is activated.

AddinInstall

Occurs when the workbook is installed as an add-in.

AddinUninstall

Occurs when the workbook is uninstalled as an add-in.

BeforeClose

Occurs before the workbook closes.

BeforePrint

Occurs before the workbook (or anything in it) is printed.

BeforeSave

Occurs before the workbook is saved.

Deactivate

Occurs when the workbook is deactivated.

NewSheet

Occurs when a new sheet is created in the workbook.

Open

Occurs when the workbook is opened.

PivotTableCloseConnection (Excel 10 only)

Occurs after a PivotTable closes the connection to its data source.

PivotTableOpenConnection(Excel 10 only)

Occurs after a PivotTable opens the connection to its data source.

SheetActivate

Occurs when any sheet is activated.

SheetBeforeDoubleClick

Occurs when any worksheet is double-clicked, before the default double-click action.

SheetBeforeRightClick

Occurs when any worksheet is right-clicked, before the default right-click action.

SheetCalculate

Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.

SheetChange

Occurs when cells in any worksheet are changed by the user or by an external link.

SheetDeactivate

Occurs when any sheet is deactivated.

SheetSelectionChange

Occurs when the selection changes on any worksheet (does not occur if the selection is on a chart sheet).

WindowActivate

Occurs when any workbook window is activated.

WindowDeactivate

Occurs when any workbook window is deactivated.

WindowResize

Occurs when any workbook window is resized.

Incidentally, a user can suppress the Open event for a workbook by holding down the Shift key when opening the workbook.

0 0

Post a comment