![]() |
Reset userform?
I have a userform which contains no less than 32 testboxes of information!
Depending on which button the user clicks, on the userform, the text boxes will contain different information. Is there a way to clear the contents of all the text boxes, thus not having 32 VBA lines, like... Textbox_01.Caption = "" Textbox_02.Caption = "" Etc... Maybe something like... For Each Textbox In Me .Caption = "" Next (Tried the above - didn't work) And the same 'problem' with Checkboxes? Is there a way to reset all checkboxes in a userform? Thanks in advance... |
Reset userform?
try this
For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then ctl.Value = "" Next ctl On Jun 28, 1:26*pm, "Charlotte E" <@ wrote: I have a userform which contains no less than 32 testboxes of information! Depending on which button the user clicks, on the userform, the text boxes will contain different information. Is there a way to clear the contents of all the text boxes, thus not having 32 VBA lines, like... Textbox_01.Caption = "" Textbox_02.Caption = "" Etc... Maybe something like... For Each Textbox In Me * * .Caption = "" Next (Tried the above - didn't work) And the same 'problem' with Checkboxes? Is there a way to reset all checkboxes in a userform? Thanks in advance... |
Reset userform?
Working - thanks :-)
muddan madhu wrote: try this For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then ctl.Value = "" Next ctl On Jun 28, 1:26 pm, "Charlotte E" <@ wrote: I have a userform which contains no less than 32 testboxes of information! Depending on which button the user clicks, on the userform, the text boxes will contain different information. Is there a way to clear the contents of all the text boxes, thus not having 32 VBA lines, like... Textbox_01.Caption = "" Textbox_02.Caption = "" Etc... Maybe something like... For Each Textbox In Me .Caption = "" Next (Tried the above - didn't work) And the same 'problem' with Checkboxes? Is there a way to reset all checkboxes in a userform? Thanks in advance... |
All times are GMT +1. The time now is 09:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com