troubleshooting Question

Deselect all optionbuttons on userform to 0

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
Microsoft Excel
5 Comments1 Solution459 ViewsLast Modified:
excel 2010
Userform
Multipage1 control
Page 5

The following code will deselect all the optionbuttons on all pages.
ans also code not owrking just for Page5?

I need just specifically for page 5


' this works but does all the optionbuttons on any page
Dim cCont As Control
     
    For Each cCont In Me.Controls
        If TypeName(cCont) = "OptionButton" Then
            cCont.Value = False
        End If
   Next cCont


' specficially for page 5 but getting error

Dim pg As Pages
Dim ctl As MSForms.Control
Dim OptChecked As String
      Set pg = Me.MultiPage1.Pages(5) ' pages are 0 indexed  <--- error here "type mismatch
    For Each ctl In pg.Controls
              If TypeName(ctl) = "OptionButton" Then
                    ctl.Value = 0
              End If
    Next ctl



Thanks
fordraiders
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros