Excel Guides

Workbook Events in Excel

Workbook events are triggered when certain actions are performed on a workbook, such as opening or closing it, saving it, or changing worksheets. These events can be used to run macros or custom functions whenever a workbook is opened, closed, saved, or changed. For example, you could use a workbook event to automatically save a backup copy of a workbook every time it is saved.

There are two types of workbook events: those that are triggered by an action taken by the user (such as opening or closing the workbook), and those that are triggered by an action taken by Excel (such as calculating a formula). User-initiated events can be handled by using macros or custom functions, while Excel-initiated events can be handled by using Visual Basic for Applications (VBA) code.

User-Initiated Workbook Events

The following table lists the user-initiated workbook events:

Workbook_OpenTriggered when the workbook is opened
Workbook_ActivateTriggered when the workbook becomes the active workbook
Workbook_DeactivateTriggered when the workbook is no longer the active workbook
Workbook_BeforeCloseTriggered when the workbook is about to be closed
Workbook_AfterSaveTriggered after the workbook is saved
> > > > > > >Eventt>> > > > > > >Triggeredd when any cell in thee workebooke is calculated,, including cells that are not part of any formulasf.. For example,, if cell A1 contains thee formula =B1+C1 and cell B1 changes value,, then thee event willl be triggered for both A1 and B11.. If you have many formulas in your workebooke,, this event can slow down your computerr.. To improve performance,, you can disable this event by setting thee Application.EnableEvents property to False before making any changes,, and then set it back to True after thee changes have been madee.. > >

Move beyond 


Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.