View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Foolproof way to trap Worksheet Change?

Nick,
Appreciate the feedback.
As Microsoft "improves" each version problems emerge.
There are lots of improvements in the forthcoming xl 2007.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Nick"
wrote in message
Wow! This works with everything I've thrown at it -- changing sheets via
tabs, hyperlinks, Goto, web toolbar.

It's interesting that your solution works even when Workbook_SheetActivate
does not. I would have guessed they would respond to the same events. (I'm
testing under XL2000, since I don't know which versions my users have, so it
may have been fixed in XL2002.)
Thanks, much appreciated!
Nick


"Jim Cone" wrote:
Using OnSheetActivate and OnSheetDeactivate works in XL2000.
(XL5 code)
In your workbook open event place something like this,
for each desired sheet ...

Sub FixItUp()
Me.Worksheets("Sheet3").OnSheetActivate = "DoThis"
Me.Worksheets("Sheet3").OnSheetDeactivate = "DoThat"
End Sub

In your workbook close event use code like this for every
sheet listed above ...
Sub UndoFix()
Me.Worksheets("Sheet3").OnSheetActivate = ""
Me.Worksheets("Sheet3").OnSheetDeactivate = ""
End Sub

DoThis and DoThat are the subs that run when the applicable
sheet is activated/deactivated. Place those subs in a general module.
Any of the sub names can be names you choose.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware