Subscribe for Weekly Tutorials
BONUS: subscribe now to download our Top Tutorials Ebook!
Reset All Values in a UserForm
Clear or reset all values in a UserForm so that they contain only the default original values.
This method will remove all input and selections made by the user.
Sections:
Reset UserForm
To do this, we simply close the form and then reopen it. This is the easiest way to completely reset the form and go back to the original values for each control.
Unload Me
UserForm1.Show
The first line removes the UserForm and the second line makes it reappear.
UserForm1 is the name of the form that you want to show. You get this from the (Name) section of the Properties window when you select the form.
You can use the above code however you like, but it is often attached to a button within the UserForm.
In this example, double-click the Reset Form button and place the code within the code section that appears for this button:
The name of the Reset Form button is CommandButton3.
Now, we have a button in the form that will reset everything back to the way the form was when it was originally opened.
Notes
When you use this method to clear/reset a form, you will see the window flicker; that is just the current form being closed and then re-opened again.
Make sure to download the attached file to get this example in Excel.
Question? Ask it in our Excel Forum
Tutorial: How to loop through all controls in a UserForm; this allows you to do things like get valu...
Tutorial: How to fill a Listbox with values in a UserForm. By default, a Listbox in a form will be e...
Tutorial: Use a formula to count the number of unique values that are contained within a list in Exc...
Macro: Excel macro that will delete all of the comment contained within the active or current wor...
Tutorial: Add values to a ComboBox in a UserForm in Excel. There are 3 simple ways to add values, tw...
Tutorial: How to highlight duplicate values in a list. Also, how to arrange those values next to ea...