Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trap show toolbar event [email protected] Links and Linking in Excel 0 April 27th 07 04:16 PM
Trap SheetBeforeRightClick event from another workbook mp112849 Excel Programming 2 June 15th 05 10:32 AM
How to trap delete row event and hide column event? Alan Excel Programming 3 April 26th 05 04:25 PM
Trap CTRL+C keypress event Nick Excel Programming 4 January 30th 04 09:17 PM
how to trap a event coming from a dll E.Anderegg Excel Programming 6 October 16th 03 01:53 PM


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"