Reset userform?

C

Charlotte E

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...
 
M

muddan madhu

try this

For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then ctl.Value = ""
Next ctl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top