excel vba descargando contenido de un formulario

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.

¡Gracias!

preguntado el 09 de marzo de 12 a las 16:03

2 Respuestas

Cambiar form.Hide a Unload Me

respondido 09 mar '12, 16:03

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 

respondido 09 mar '12, 16:03

Chuck you don't need to call Unload Me from UserForm_QueryClose(). The user already has a Cancel Button from where he can call the code - Huida de Siddharth

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.