Share via


SheetDeactivate Event

Occurs when a worksheet is deactivated.

Private SubObject**_SheetDeactivate**(ByValShAs Worksheet)

Object The name of the Spreadsheet object that you are trapping this event for.

Sh    Required Worksheet. The worksheet that has been deactivated.

Remarks

When a user changes worksheets, this event is called before the SheetActivate event.

Example

This example displays the name of the deactivated worksheet each time that a worksheet is deactivated in Spreadsheet1.

Sub Spreadsheet1_SheetDeactivate(Sh)

   MsgBox Sh.Name & " was just deactivated."

End Sub

Applies to | Spreadsheet Object