Urgent - VBA Code Not Running

  • Thread starter Thread starter x-rays
  • Start date Start date
X

x-rays

Hello All,

Newbie question.

I wrote some code for a workbook and specifically I use the events of
the worksheet (I have 4 sheets) to catch the Selectionchange and
change. The first time the code was running fine but when I closed and
reopened the file the code did not run again.

What's going on?
 
Usually that happens when the Application.EnableEvents is turned off.
To check just go to the immediate window and type
? Application.EnableEvents
 
Hard to say from your limited description but my best guess would be that
your code probably toggles Application.EnableEvents on and off. If your code
turns events off and does not turn them back on again then No events will be
firing. Try running this little procedure and see if it helps

Sub ReEnable()
Application.EnableEvents = True
end sub

If that fixes your problems then you need to find out why your events were
turned off without being turned on again. If you need help with that just
reply back...
 
Now says that I have to enable the macros and refer to online help
 
Ok guys it works with the Application.EnableEvents = True

I had first to close and reopen the file.

Thank you all very very much!

Have a nice day (or night)!
 

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