Reset All Values in a UserForm

Add to Favorites
Author: | Edits: don

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

Notes

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.

f09713815930348f3e185c31b2b7a5ba.png

In this example, double-click the Reset Form button and place the code within the code section that appears for this button:

0fdc29d8e65c95ec72cc72827c35c106.png

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.


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Loop Through Controls in a UserForm
Tutorial: How to loop through all controls in a UserForm; this allows you to do things like get valu...
Add Values to a ListBox
Tutorial: How to fill a Listbox with values in a UserForm. By default, a Listbox in a form will be e...
Count the Number of Unique Values in a List in Excel
Tutorial: Use a formula to count the number of unique values that are contained within a list in Exc...
Delete All Comments in a Worksheet in Excel Macro
Macro: Excel macro that will delete all of the comment contained within the active or current wor...
Add Values to a ComboBox
Tutorial: Add values to a ComboBox in a UserForm in Excel. There are 3 simple ways to add values, tw...
Highlight Duplicate Values in Excel
Tutorial: How to highlight duplicate values in a list. Also, how to arrange those values next to ea...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course