Sub erroneously calls another sub

  • Thread starter Thread starter Jay Northrop
  • Start date Start date
J

Jay Northrop

Greetings !

In my workbook, I have a 'change event' macro (started with the line
"Private Sub Worksheet_Change(ByVal Target as Range"). After much work, this
macro runs just fine.

My problem is that a totally separate macro, which I call
"Clear_Glass_Data", somehow calls the 'change event' macro into play. I'm
guessing that this happens because the "Clear_Glass_Data" changes many cell
values from TRUE to FALSE, therefore causing an "event" change. Is there a
way of isolating my "Clear_Glass_Data" macro so that it can't see or call
any other macros??

Thanks for your help,

Jay N.
 
Jay,

Events can be disabled in excel by use of Application.EnableEvents

You must ALWAYS remember to enable events when you have finished.

I normally do it like this ...

Application.EnableEvents = False
Your update code
Application.EnableEvents = True

and
dont forget to put in an error trap that has
Application.EnableEvents = True included.


I would imagine that this code would be placed in your Clear_Glass_Dat
macro
 
Kieran,

Thanks so much for your help! Your suggestion works perfectly, and I have
learned something new.

Jay
 

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