Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Disable SelectionChange Event
I have a spreadsheet which has code behind the SelectionChange event. When I
am working on (editing) the worksheet, I want the code active. Later, when I run a macro to do processing on the worksheet, I want this code deactivated. Is it possible to use EnableEvents and specify a specific workbook and/or worksheet and/or event (the SelectionChange event), or does EnableEvents always apply to the entire application? Is there anyway to disable a specific event, or is that ever really necessary? Does EnableEvents affect anything other than workbook and worksheet events? It seemed to bypass an InputBox sequence when I set it equal to false in one test. -- Bill @ UAMS |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Disable SelectionChange Event
Application.enableevents is an application property.
You could turn it off before you do anything in your macro--it'll affect both workbook, worksheet and application events. If you want to be more specific, you could set up a global variable: Public BlkMyEvents as boolean sub testme() blkmyevents = true 'do something that would cause a specific event to fire 'select a cell on a worksheet with a _selectionchange procedure blkmyevents = false end sub Then behind that worksheet: Private Sub Worksheet_SelectionChange(ByVal Target As Range) if blkmyevents = true then exit sub 'normal code here. End Sub BillCPA wrote: I have a spreadsheet which has code behind the SelectionChange event. When I am working on (editing) the worksheet, I want the code active. Later, when I run a macro to do processing on the worksheet, I want this code deactivated. Is it possible to use EnableEvents and specify a specific workbook and/or worksheet and/or event (the SelectionChange event), or does EnableEvents always apply to the entire application? Is there anyway to disable a specific event, or is that ever really necessary? Does EnableEvents affect anything other than workbook and worksheet events? It seemed to bypass an InputBox sequence when I set it equal to false in one test. -- Bill @ UAMS -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Disable SelectionChange Event
I put in the stuff for using a specific variable. Works well - thanks for
your help! -- Bill @ UAMS "Dave Peterson" wrote: Application.enableevents is an application property. You could turn it off before you do anything in your macro--it'll affect both workbook, worksheet and application events. If you want to be more specific, you could set up a global variable: Public BlkMyEvents as boolean sub testme() blkmyevents = true 'do something that would cause a specific event to fire 'select a cell on a worksheet with a _selectionchange procedure blkmyevents = false end sub Then behind that worksheet: Private Sub Worksheet_SelectionChange(ByVal Target As Range) if blkmyevents = true then exit sub 'normal code here. End Sub BillCPA wrote: I have a spreadsheet which has code behind the SelectionChange event. When I am working on (editing) the worksheet, I want the code active. Later, when I run a macro to do processing on the worksheet, I want this code deactivated. Is it possible to use EnableEvents and specify a specific workbook and/or worksheet and/or event (the SelectionChange event), or does EnableEvents always apply to the entire application? Is there anyway to disable a specific event, or is that ever really necessary? Does EnableEvents affect anything other than workbook and worksheet events? It seemed to bypass an InputBox sequence when I set it equal to false in one test. -- Bill @ UAMS -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to Start Excel Event ID 2001 | Excel Discussion (Misc queries) | |||
Using excel to manage event - ANY input deeply appreciated! :-) | Excel Discussion (Misc queries) | |||
Same event, multiple sheets? | Excel Discussion (Misc queries) | |||
Excel Automation SelectionChange event | Excel Discussion (Misc queries) | |||
Worksheet Row Change event | Excel Discussion (Misc queries) |