Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Stop Worksheet_SelectionChange event from firing?

Jan Karel and Bob,

Interesting points. Which choice of method is a dilemma I've struggled with.
Ideally I prefer to disable/enable events, but no matter how good my error
handling there is always the possibility of some unknown interaction with
other stuff in the user's app.

Eg a calculation caused by writing to cells can fire user's udf's, even in
an unrelated workbook. If these are not correctly handled they can cause all
code to just stop (not same as "end"), without realising variables in my
code (particularly problematic in xl97). Of course the solution is to
disable calculation but that's just another thing that might not get reset
correctly. In any case would prefer not to disable calculation merely to
cater for a small possibility of such a problem.

Regards,
Peter T

"Jan Karel Pieterse" wrote in message
...
Hi Bob,

I was also thinking about the variable approach which I noticed in your
other response. That approach can fail just as easily, but of course

events
only get disabled if they use that variable, other events continue ok.

My
thoughts went along the lines, is it better to be wrong some of the time
(when the variable gets knocked out), or to be wrong all of the time (if
EnableEvents get knocked out). Couldn't come to a conclusion, as the

famous
phrase '... it depends ...' kicks in, so we have to adopt a solution to

suit
(as ever ;-)).


Agreed. Another advantage I see in using a variable is when one clicks End

on
an error message, the variable gets reset to false automatically and the

event
works once more.

But as stated in this thread more than once, the only true solution is to

use
proper error handling in the subs concerned.

Whether one uses a (static or global) variable to prevent local (or even
projectwide) looping or EnableEvents to prevent global looping depends on

the
situation.
Of course to be completely foolproof, I guess it is the latter. One never
knows what other code is "active" besides ones own application.

So: Implement Error handling!!!

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com



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
Worksheet change event not firing Wexler Excel Programming 11 October 25th 04 09:45 PM
worksheet_SelectionChange Event ibeetb Excel Programming 1 January 16th 04 04:05 AM
Workbook.Open Event Procedure not firing Gordon Rodman Excel Programming 1 October 17th 03 05:03 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM
Worksheet_SelectionChange Event G R E G Excel Programming 5 August 27th 03 07:59 PM


All times are GMT +1. The time now is 12:41 PM.

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

About Us

"It's about Microsoft Excel"