Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2000: Avoiding loop in Worksheet_Change event
Hi
I have a Change Event for a worksheet, where 2 cells on this worksheet are checked, and some actions are taken, whenever some of them changes. By certain conditions, one of actions will be changing the entry in one of checked cells - which will fire the same Change event again, etc. Is there a way to 'switch the Change Event firing off' temporarily. I mean, that when the condition for changing this cell value is met, some code row has to switch executing of further Change events off, after that the change to cell is made, then further change events are turned on again, and then rest of code in current Change event is processed. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2000: Avoiding loop in Worksheet_Change event
Application.EnableEvents=False
do your logic Application.EnableEvents=True -- Gary''s Student - gsnu2007h |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2000: Avoiding loop in Worksheet_Change event
Thanks!
Arvi Laanemets |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2000: Avoiding loop in Worksheet_Change event
Gary''s Student schrieb:
Application.EnableEvents=False do your logic Application.EnableEvents=True You might also want to include some error handling. Here's a good introduction on how to do this: http://www.cpearson.com/excel/ErrorHandling.htm The reason: If an error occurs in your logic, the events stay disabled. Your code for Worksheet_change will not run anymore. Happened to me all the time recently while developing a small Excel application. CU, Christian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel2000 worksheet Change event doesn't work in Excel2003 or higher | Excel Programming | |||
How do I change a Worksheet_change event to a beforesave event? | Excel Programming | |||
Worksheet_change event. | Excel Programming | |||
Excel2000 VBA If-Then/Loop Failures | Excel Programming | |||
Worksheet_Change Event | Excel Programming |