UserForms: Clear all Option Buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a file that uses several userforms. These userforms have several
option buttons and check boxes on each.


During "UserForm_Activate()" what code will clear all option buttons and
check boxes at once?
 
This won't work?

Sub ClearOptButChBx()

Dim usf As UserForm
Dim OLEObj As OLEObject

Set usf = ActiveUserForm

For Each OLEObj In usf.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Or TypeOf OLEObj.Object
Is MSForms.OptionButton Then
OLEObj.Object.Value = False
End If
Next OLEObj

End Sub
 
Instead of setting the userform to "hide" I "unload" it. That seems to do
the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top