View Full Version : Solved: any way to clear textboxes on a userform?
lvito001
09-14-2007, 05:21 AM
I have a userform that contains 2 comboboxes and 6 textboxes. I'd like the textboxes to clear everytime the combobox #2 selection is changed by a user. any ideas on how to do this? :doh:
Bob Phillips
09-14-2007, 05:59 AM
Private Sub ComboBox2_Change()
With Me
.TextBox1.Text = ""
.TextBox1.Text = ""
.TextBox2.Text = ""
.TextBox3.Text = ""
.TextBox4.Text = ""
.TextBox5.Text = ""
.TextBox6.Text = ""
End With
End Sub
lvito001
09-14-2007, 06:09 AM
thanks! that works perfect. sorry if it was a common sense answer, im a newbie!
Bob Phillips
09-14-2007, 06:11 AM
We all were once :hi:
FYI, you could also use a loop like this if you have a lot of textboxes and you want them all cleared:
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is MSForms.TextBox Then ctl.Text = ""
Next ctl
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.