Link to home
Start Free TrialLog in
Avatar of slobber72
slobber72

asked on

Excel userform option button / frames - retrieving value

Hello,

i would like to understand how to know which option button has been chosen in an option group (frame) on my form.
User generated image.

How can I find the value, or, which radio button has been selected ?
I have tried me.frame2.blah.... but I can't see a property in the frame2 collection referring to which option/radio button has been selected.

Any help is appreciated.

Thanks,

Craig
Avatar of slobber72
slobber72

ASKER

Hi again,

I have created the following function to get the value of the option button selected.

Is this the proper way to get this info ?

Private Function get_comment_type(ByVal comment_frame As frame)

Dim o As Control
Dim comment_type As String

For Each o In comment_frame.Controls
    If o.Value = True Then
        comment_type = o.Caption
        Exit For
    End If
Next o

get_comment_type = comment_type

End Function

Open in new window


It works quite well - but I was wondering if it is needed, or if it is accessible directly from the frame object.

Cheers,

Craig
ASKER CERTIFIED SOLUTION
Avatar of dlmille
dlmille
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Terrific - again !!
Thanks Dave.