ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sub erroneously calls another sub (https://www.excelbanter.com/excel-programming/314357-sub-erroneously-calls-another-sub.html)

Jay Northrop

Sub erroneously calls another sub
 
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.



Kieran[_52_]

Sub erroneously calls another sub
 

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

--
Kiera

Born ignorant and still perfecting the ar
-----------------------------------------------------------------------
Kieran's Profile: http://www.excelforum.com/member.php...nfo&userid=124
View this thread: http://www.excelforum.com/showthread.php?threadid=27144


Jay Northrop

Sub erroneously calls another sub
 
Kieran,

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

Jay


"Kieran" wrote in message
...

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_Data
macro.


--
Kieran

Born ignorant and still perfecting the art
------------------------------------------------------------------------
Kieran's Profile:
http://www.excelforum.com/member.php...fo&userid=1247
View this thread: http://www.excelforum.com/showthread...hreadid=271446





All times are GMT +1. The time now is 10:33 PM.

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