Reputation: 1461
I have a userform that is opened when a user clicks a button in a worksheet. After clicking the button, if the user inputs some data, then decides to close the form, the previously entered data remains in the form. How can (in code) I get rid of that data so it opens with the default every time the button is clicked?
Currently I just use
form.Show
when the button is clicked and
form.Hide
when the user hits the cancel button within the form.
Thanks!
Upvotes: 0
Views: 1752
Reputation: 387
You could catch the closing event and call unload inside like this
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload Me
End Sub
Upvotes: 0