Is there any way to suppress Worksheet_SelectionChange in instances where
the selection change comes from a programmed command rather than user
action?
Insert just before the line of code that would otherwise trigger the event.
Make sure you always get it set back to True before code stops executing,
whether by error handler or before end/exit sub.
Application.EnableEvents = False
'make your selection changes
Application.EnableEvents = True
Or, if you have access to the code, you could insert a check in your
Worksheet_SelectionChange code to check the value of a global variable
and exit without any action if required.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False does exactly what I need.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.