ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Events won't Disable! (https://www.excelbanter.com/excel-discussion-misc-queries/85052-events-wont-disable.html)

roadkill

Events won't Disable!
 
I have 2 combo boxes on the same sheet and both have Combobox_Change() event
code associated with them. This code resides in the sheet object (same
sheet) and both macros call other routines in a module in this same
spreadsheet file. When one of these events fires, I want to inhibit the
other from firing while the first's code is executing. I've tried using
Application.EnableEvents = False, but it's just ignored. Does anyone know
why this would be?

Thanks,
Will

Dave Peterson

Events won't Disable!
 
Changes to these controls aren't affected by application.enableevents settings
(as you've seen).

But you could do the same sort of thing...

Dim BlkProc as boolean

private sub combobox1_change()
if blkproc = true then exit sub
'rest of your code here
end sub



private sub combobox2_change()
if blkproc = true then exit sub
'rest of your code here
blkproc = true
'some code that would cause combobox1_change to fire
blkproc = false

end sub

roadkill wrote:

I have 2 combo boxes on the same sheet and both have Combobox_Change() event
code associated with them. This code resides in the sheet object (same
sheet) and both macros call other routines in a module in this same
spreadsheet file. When one of these events fires, I want to inhibit the
other from firing while the first's code is executing. I've tried using
Application.EnableEvents = False, but it's just ignored. Does anyone know
why this would be?

Thanks,
Will


--

Dave Peterson

roadkill

Events won't Disable!
 
Thanks - that worked just fine. What events DOES the EnableEvents setting
affect?

"Dave Peterson" wrote:

Changes to these controls aren't affected by application.enableevents settings
(as you've seen).

But you could do the same sort of thing...

Dim BlkProc as boolean

private sub combobox1_change()
if blkproc = true then exit sub
'rest of your code here
end sub



private sub combobox2_change()
if blkproc = true then exit sub
'rest of your code here
blkproc = true
'some code that would cause combobox1_change to fire
blkproc = false

end sub

roadkill wrote:

I have 2 combo boxes on the same sheet and both have Combobox_Change() event
code associated with them. This code resides in the sheet object (same
sheet) and both macros call other routines in a module in this same
spreadsheet file. When one of these events fires, I want to inhibit the
other from firing while the first's code is executing. I've tried using
Application.EnableEvents = False, but it's just ignored. Does anyone know
why this would be?

Thanks,
Will


--

Dave Peterson



All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com