ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Userform Events (https://www.excelbanter.com/excel-programming/425096-disable-userform-events.html)

Ryan H

Disable Userform Events
 
Is there a way to keep userform events from firing? I don't want my
Combobox_Change Events firing when I click my command button.
--
Cheers,
Ryan

Bernie Deitrick

Disable Userform Events
 
Ryan,

An easy way to control execution of code is to use a global boolean, and check that value for a
state:

Public boolUFEventsDisabled As Boolean

Set it to true using some event, like the form load, or a button click:

boolUFEventsDisabled = True


Then at the top of all events, use

If boolUFEventsDisabled Then Exit Sub

and have some way to re-enable it...

HTH,
Bernie
MS Excel MVP


"Ryan H" wrote in message
...
Is there a way to keep userform events from firing? I don't want my
Combobox_Change Events firing when I click my command button.
--
Cheers,
Ryan





All times are GMT +1. The time now is 09:53 AM.

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