![]() |
Updating .tag in Userform Control in VBA
I am trying to adjust the tag property of approx. 150
different controls in a userform using a list from an excel spreadsheet. I wrote the following code to do this: For Each Ctl In Main.Controls With Range("Controls") Set x = .Find(Ctl.Name, lookat:=xlWhole) If Not x Is Nothing Then Ctl.Tag = x.Offset(0, 1).Value End If End With Next Ctl --"Controls" is the list of controls with the tag I want entered in the neighboring column If I step through the code, it seems to pull information correctly...I am able to see which control is being pulled up, what the value of the tag should be set to, even the Ctl.Tag seems to correct...but for some reason, the tag is not adjusted in the form when the macro finishes. Anyone have any ideas? |
Updating .tag in Userform Control in VBA
Chan,
No you will never change the default state of the tags in code, but by putting it in the initialize event it will always be there whilst the form is active. The other thing is to hide the form not unload it as suggested, that way even if the form is not visible it is in memory and the tags will persist for the time. -- HTH Bob Phillips "Chan" wrote in message ... Bob, Great insights. Thanks. By including the code in the form_initialize event, will the tags actually update, or will they just update until the form closes? Chan |
All times are GMT +1. The time now is 10:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com