OnSheetDeactivate Property

Applies To

Application Object, Chart Object, DialogSheet Object, Module Object, Workbook Object, Worksheet Object.

Description

Returns or sets the name of the macro that runs when the user deactivates the specified sheet (Chart, DialogSheet, Module, or Worksheet object), any sheet in the specified workbook (Workbook object), or any sheet in any open workbook (Application object). Read-write.

See Also

OnSheetActivate Property, OnWindow Property, RunAutoMacros Method.

Example

This example sets the OnSheetDeactivate property to the macro "my_Deactivate_Sub" in Module1 in the active workbook. This macro will run whenever the user deactivates a sheet in any workbook.


Application.OnSheetDeactivate = ActiveWorkbook.Name & _
    "!Module1.my_Deactivate_Sub"

This example removes the OnSheetDeactivate macro.


Application.OnSheetDeactivate = ""