Getting a Userform to reset itself back to blank

sandyboath

New Member
Joined
Mar 21, 2006
Messages
42
have created a userform for people to fill out a travel request, this is a combination of Txt boxes and List/ Combo boxes.

I am able to get the fom open but when used to fill in the form the next time the formopen it retains the information from the previous user.

I would like when the X (Close button is pressed) the form clears itself and then closed.

I have tried TextBox1.Value = "", but there is over 15 txt boxes a and it did not work

Can anyone help please

Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Paddy1979

Well-known Member
Joined
Sep 23, 2005
Messages
608
Hi,

This will reset them to blank using a loop.

Change '15' to the qty of textbox's on the form

Code:
Private Sub UserForm_Activate()

Dim ctrl As TextBox
Dim i As Long

For i = 1 To 15
Me.Controls("TextBox" & i).Value = ""
Next i

End Sub
 
Upvote 0

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,367
Office Version
  1. 365
Platform
  1. Windows
Why not unload the form then display it again?
Code:
Unload Me
UserForm1.Show
 
Upvote 0

Forum statistics

Threads
1,195,628
Messages
6,010,772
Members
441,568
Latest member
abbyabby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top