ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   preventing code from running (https://www.excelbanter.com/excel-programming/356572-preventing-code-running.html)

anny

preventing code from running
 
hi all
I'm sure this is easy, but I'm a bit stuck.

I have a sub that is executed when the Worksheet_Change event fires. There
is also a macro that I run (mod_Evaluate) while working on that sheet. Both
sets of code work fine, but...

I want Worksheet_Change code to be in effect at all times EXCEPT when I run
mod_Evaluate. What code can I add to mod_Evaluate to temporarily stop the
Worksheet_Change code?

Thank you
anny










Otto Moehrbach

preventing code from running
 
Application.EnableEvents = False
'Your macro code
Application.EnableEvents = True
HTH Otto
"anny" wrote in message
...
hi all
I'm sure this is easy, but I'm a bit stuck.

I have a sub that is executed when the Worksheet_Change event fires.
There is also a macro that I run (mod_Evaluate) while working on that
sheet. Both sets of code work fine, but...

I want Worksheet_Change code to be in effect at all times EXCEPT when I
run mod_Evaluate. What code can I add to mod_Evaluate to temporarily stop
the Worksheet_Change code?

Thank you
anny













All times are GMT +1. The time now is 02:46 PM.

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