View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Stop Worksheet_SelectionChange event from firing?

The most obvious suggestion: Don't select E3 -- a la Tom's method 3.

However, even that will trigger the _Change event and/or the _Calculate
event. If this workbook (or some other open workbook or loaded add-in)
has an event procedure for those events, they will be executed.

In such cases, I strongly endorse a variant of the EnableEvents
approach. However, it is a persistent property. Consequently, you
*must* -- come hell or high water *must* -- enable events again.

My standard approach is:

'...
Application.EnableEvents=false
on error goto ErrXIT
'...
ErrXIT:
Application.EnableEvents=true
end sub

The static variable approach is useful in those cases where XL/VBA do
not disable certain types of events, typically in conjunction with MS
Forms. However, other than in specific instances it is a pain to
implement and impossible to enforce in a true multiple-client
environment.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I'm playing with getting a macro to fire every time a certain cell is
triggered. I'm using the Worksheet_SelectionChange event. Using an If
statement, I can get the macro to fire if a certain cell is selected. BUT -
the macro selects other cells, which interrupts the running macro to
re-evaluate the SelectionChange event! Is there a way to stop this?

Ed