Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Suppress Worksheet_SelectionChange conditionally

Is there any way to suppress Worksheet_SelectionChange in instances where
the selection change comes from a programmed command rather than user
action?

--
Ian
--


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Suppress Worksheet_SelectionChange conditionally

Application.EnableEvents = False

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.

"IanC" wrote:

Is there any way to suppress Worksheet_SelectionChange in instances where
the selection change comes from a programmed command rather than user
action?

--
Ian
--


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Suppress Worksheet_SelectionChange conditionally

You could try

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)

If DoNothing Then Exit Sub

'....other code here
End Sub



Tim




On Apr 15, 10:52*am, "IanC" wrote:
Is there any way to suppress Worksheet_SelectionChange in instances where
the selection change comes from a programmed command rather than user
action?

--
Ian
--


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Suppress Worksheet_SelectionChange conditionally

Many thanks to B Lynn B & Tim Williams.

Application.EnableEvents = False does exactly what I need.

--
IanC
--


"IanC" wrote in message
...
Is there any way to suppress Worksheet_SelectionChange in instances where
the selection change comes from a programmed command rather than user
action?

--
Ian
--




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_SelectionChange Kerri Grant Excel Programming 2 February 16th 10 02:23 PM
Worksheet_SelectionChange Gary''s Student Excel Programming 3 April 5th 06 09:46 AM
Worksheet_SelectionChange mangesh_yadav[_144_] Excel Programming 0 October 25th 04 12:56 PM
Worksheet_SelectionChange Rasmus[_2_] Excel Programming 2 June 27th 04 07:19 PM
Worksheet_SelectionChange Bill Oertell[_2_] Excel Programming 8 April 23rd 04 05:18 AM


All times are GMT +1. The time now is 05:30 PM.

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

About Us

"It's about Microsoft Excel"