Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clearing cells without clearing formulas | Excel Discussion (Misc queries) | |||
Clearing #N/A's in one go? | Excel Worksheet Functions | |||
Clearing #VALUE | Excel Worksheet Functions | |||
what is clearing an assumption? | Excel Worksheet Functions | |||
Clearing list from all form commandboxes | Excel Programming |