![]() |
How to trap the worksheet_BeforeDeactivate event?
The worksheet_deactivate event works like worksheet_afterdeactivate event.
How do i trap the worksheet_beforeDeactivate event? |
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? |
All times are GMT +1. The time now is 12:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com