Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Carolina Lopez   on Nov 08 In MS Office Category.

  
Question Answered By: Cain Smith   on Nov 08

> The negative IF is deliberate. Excel will default your variable to
false...
> I dislike negative IFs from a style point of view. But this is one
time when there is a slight technical benefit.

I disliked the neg-If, but I realized the benefit of this after
responding yesterday -- and your words sunk-in.
Also, a name, more palatible in the negative-If paradigm, can be
selected such as "EventsDisabled" or simply "Disabled", or even "Off"
if fingers are getting tired (:-).

If Not Disabled Then
Do whatever... Has a nice ring to it.
EndIf


> > Looks like only one var is needed for the whole Project.
> I use one per module, rather than making them global ...
> However it's unusual to need more than one in any single module.

I know professional programmers prefer locals, but this seems like
a case where a Global works nicely.


> Variable naming is a very personal thing...

Of course, but hearing someone else's idea certianly can help.

I am changing cell values in other (external to the _Change)
module, it is no longer a nested (or recursive) call any more.
I'll set the global "Disabled" to True then change  the cell value.
Then, in the _Change event  handler, it'll ignore. One Global
"Disabled" will work  fine for all "ignore" situations. Since I have
many such places where I change either cell values or CheckBoxes, I
then add the If to each _Change Sub.
Though I thought of the concept of adding such a variable, I hadn't
thought the paradign through, but your example immediately made it
crystal clear and allowed me to think through my needs very well.

Share: 

 

This Question has 8 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Want to disable a Checkbox_click event Or get search suggestion and latest updates.


Tagged: