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:
Printable View
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:
[vba]
Private Sub ComboBox2_Change()
With Me
.TextBox1.Text = ""
.TextBox1.Text = ""
.TextBox2.Text = ""
.TextBox3.Text = ""
.TextBox4.Text = ""
.TextBox5.Text = ""
.TextBox6.Text = ""
End With
End Sub
[/vba]
thanks! that works perfect. sorry if it was a common sense answer, im a newbie!
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:
[VBA] Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is MSForms.TextBox Then ctl.Text = ""
Next ctl
[/VBA]