![]() |
Linked Textbox Controls on Form - Avoiding Cascading Change Events
Hello
I have 3 textboxes on a form. I want to allow the user to change one of them and for the other 2 to automatically update. My code looks something like this: Box1_Change Box2.value = ........ Box3.value = ........ end However, when I set the values on the other boxes I start their Change methods and I end up in an infinite loop. I have tried an "Application.EnableEvents = False" to avoid this but it didn't work. Any ideas on how to avoid this situation? Thanks, Steve |
Linked Textbox Controls on Form - Avoiding Cascading Change Events
Steve,
EnableEvents does not function in UserForms. You can use a boolean flag to the same end however. Declare a private variable at the top of the form module.. Private blnEnable As Boolean In the Box1_Change code... Box1_Change blnEnable = True Box2.value = ........ Box3.value = ........ blnEnable = False End Sub At the start of the Box2 and Box3 change code... If blnEnable then Exit Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Blue Aardvark" wrote in message Hello I have 3 textboxes on a form. I want to allow the user to change one of them and for the other 2 to automatically update. My code looks something like this: Box1_Change Box2.value = ........ Box3.value = ........ end However, when I set the values on the other boxes I start their Change methods and I end up in an infinite loop. I have tried an "Application.EnableEvents = False" to avoid this but it didn't work. Any ideas on how to avoid this situation? Thanks, Steve |
All times are GMT +1. The time now is 05:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com