![]() |
Clearing Form
Hi, I would to clear an Excel form (Text boxes and check boxes) after the
user has clicked the Submit button. Can any one tell me the code to do this please? TIA, PE1 |
Clearing Form
Hi Pe1
one way among several: Private Sub CommandButton1_Click() Dim C As MSForms.Control For Each C In Me.Controls Select Case TypeName(C) Case "TextBox" C.Text = "" Case "ComboBox", "ListBox" C.ListIndex = -1 Case "CheckBox", "OptionButton" C.Value = False Case Else End Select Next End Sub HTH. Best wishes Harald "PEno1" skrev i melding ... Hi, I would to clear an Excel form (Text boxes and check boxes) after the user has clicked the Submit button. Can any one tell me the code to do this please? TIA, PE1 |
Clearing Form
presuming your form is 'userform1' i *think* this should work...
sub ClearAll() on error resume next for each control in userform1.controls control.visible=false control.value=false control.text="" next control end sub the 'on error...' avoids problems of controls not having some properties, but also means that other problems might go un-noticed - maybe someone else has a better solution? hth tim "PEno1" wrote in message ... Hi, I would to clear an Excel form (Text boxes and check boxes) after the user has clicked the Submit button. Can any one tell me the code to do this please? TIA, PE1 |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com