Disable event macro while Auto_open() run

  • Thread starter Thread starter Sunil Patel
  • Start date Start date
S

Sunil Patel

New at this so discription may be wrong


Is it possible to disable an event macro (Macro in sheet 1) while Auto_Open
macro (in module) is running.
i.e excel file is opening.

one way might be to check which macro triggered the event macro. !!!

Sunil
 
The easiest way is to surround your code with this:

Sub xxx()
Application.EnableEvents = False

' your code in here


Application.EnableEvents = True
End Sub
 
Sub Auto_Open()
On Error goto ErrHandler
Application.EnableEvents = False
' current code

ErrorHandler:
Application.EnableEvents = True
End Sub
 

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