MrExcel Publishing
Your One Stop for Excel Tips & Solutions

clear text box values

Posted by jeff on July 18, 2001 8:32 AM

Is it possible to clear text box values in a form? I am trying to clear the values to reuse a userform. The first time it works, but when i try to reuse it, the old values that were entered come in again. Any ideas?

Thanks in advance


Posted by Cory on July 18, 2001 9:13 AM

I wish I knew what code you were using to clear the values the first time. Have you tried unloading the form then reloading it? That usually clears all values.


Private Sub CommandButton1_Click()
Unload UserForm1
Load Userform1
End Sub

Posted by jeff on July 18, 2001 9:27 AM


Posted by Ivan F Moala on July 18, 2001 7:49 PM

Private Sub ClearCtrls()
Dim FrmsCtrl As MSForms.Control

For Each FrmsCtrl In Me.Controls
If TypeName(FrmsCtrl) = "TextBox" Then
FrmsCtrl.Text = ""
End If
End Sub