ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reset userform (https://www.excelbanter.com/excel-programming/304251-reset-userform.html)

newbie

Reset userform
 
Is there some simple short code to clear all entries from a userform?

Chip Pearson

Reset userform
 
If you are talking about clearing text boxes, use code like the
following:

Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Newbie" wrote in message
...
Is there some simple short code to clear all entries from a

userform?



Tom Ogilvy

Reset userform
 
unload Userform1
Userform1.Show

--
Regards,
Tom Ogilvy


"Newbie" wrote in message
...
Is there some simple short code to clear all entries from a userform?




Curt

Reset userform
 
useing option button in userform. Userform goes to sheet and hides. Upon
recall there is a dot in front round window of last action. When this is in
window it disables use of option button. Seems that the userform remembers
last action. Can this last action be disabled thru properties? Or does it
need to be done with code. If code how.
Thanks You

"Chip Pearson" wrote:

If you are talking about clearing text boxes, use code like the
following:

Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Newbie" wrote in message
...
Is there some simple short code to clear all entries from a

userform?




NickHK

Reset userform
 
Curt,
If you are only hiding the userform, then all its properties remain
unchanged. But adapting Chip's code slightly for the Option button, to set
them all to False:

Dim C As MSForms.Control

For Each C In Me.Controls
If TypeOf C Is MSForms.OptionButton Then
C.Value = False
End If
Next C

NickHK

"Curt" wrote in message
...
useing option button in userform. Userform goes to sheet and hides. Upon
recall there is a dot in front round window of last action. When this is

in
window it disables use of option button. Seems that the userform remembers
last action. Can this last action be disabled thru properties? Or does it
need to be done with code. If code how.
Thanks You

"Chip Pearson" wrote:

If you are talking about clearing text boxes, use code like the
following:

Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Newbie" wrote in message
...
Is there some simple short code to clear all entries from a

userform?







All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com