A Amit Modi Member Sep 19, 2014 #1 I have 10 textbox,,textbox1 to textbox10. currently I clear as follow one by one. textbox1.value="" textbox2.value="" but its boring to type for every textbox. please provide short code for the same. thank you
I have 10 textbox,,textbox1 to textbox10. currently I clear as follow one by one. textbox1.value="" textbox2.value="" but its boring to type for every textbox. please provide short code for the same. thank you
Khalid NGO Excel Ninja Sep 19, 2014 #2 Hi Amit, something like this? Code: Sub Clear_TextBox() Dim tbx As OLEObject For Each tbx In ActiveSheet.OLEObjects If TypeName(tbx.Object) = "TextBox" Then tbx.Object.Text = "" End If Next End Sub
Hi Amit, something like this? Code: Sub Clear_TextBox() Dim tbx As OLEObject For Each tbx In ActiveSheet.OLEObjects If TypeName(tbx.Object) = "TextBox" Then tbx.Object.Text = "" End If Next End Sub
Khalid NGO Excel Ninja Sep 19, 2014 #4 Amit please see the below link for userform txtboxes: http://www.mrexcel.com/forum/excel-questions/75739-command-button-clear-userform-textboxes.html
Amit please see the below link for userform txtboxes: http://www.mrexcel.com/forum/excel-questions/75739-command-button-clear-userform-textboxes.html
Deepak Excel Ninja Sep 19, 2014 #5 check this.. Code: dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then ctl.Value = "" Next
check this.. Code: dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then ctl.Value = "" Next