Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to trap the worksheet_BeforeDeactivate event?
The worksheet_deactivate event works like worksheet_afterdeactivate event.
How do i trap the worksheet_beforeDeactivate event? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to trap the worksheet_BeforeDeactivate event?
It actually depends upon what you want to do. When Deactivate fires, the
active sheet is the new target sheet, but the Sh argument still points at the old one, so you can do something like Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) Dim this As Worksheet On Error GoTo wb_exit Application.EnableEvents = False Set this = ActiveSheet Sh.Activate 'do your stuff this.Activate wb_exit: Application.EnableEvents = True End Sub -- HTH RP (remove nothere from the email address if mailing direct) "OKLover" wrote in message ... The worksheet_deactivate event works like worksheet_afterdeactivate event. How do i trap the worksheet_beforeDeactivate event? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trap show toolbar event | Links and Linking in Excel | |||
Trap SheetBeforeRightClick event from another workbook | Excel Programming | |||
How to trap delete row event and hide column event? | Excel Programming | |||
Trap CTRL+C keypress event | Excel Programming | |||
how to trap a event coming from a dll | Excel Programming |