Turn off ThisWorkbook Code?

  • Thread starter Thread starter volodind
  • Start date Start date
V

volodind

Is there any way that I can prevent ThisWorkbook code from working
while I am running some public sub?

I have a Workbook_SheetChange procedure in ThisWorkbook, but I don't
want it to run while my other procedure is changing cells.

Thank you
 
Well, I can create a public variable = True while the module sub is
being run and check if it's True within Workbook_SheetChange sub. It
works ok, but I am just curious if there is anything that would
actually turn off ThisWorkbook code?

Thanks
 
You can turn off events (like the _SheetChange etc), but this depends on
whether you other code requires events.

Appilcation.EnableEvents = False
'Code...
'Turn back on when finished
Appilcation.EnableEvents = True

Otherwise set a Public boolean and test that at the beginning of each
routine that should/should not run.

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top