optionbutton

B

benb

What code would I use to return which optionbutton within a given frame is
checked (true)? I've tried using a for each loop but I can't figure out the
correct collection to use. I'm new to userforms (if that's not already
obvious). Thanks for the help.
 
T

Tom Ogilvy

Dim ctrl as Control
Dim oBtn as MSForms.OptionButton
for each ctrl in Userform.Frame1.controls
if type of ctrl is MSForms.OptionButton then
if ctrl.Value = true then
msgbox ctrl.name
set oBtn = ctrl
exit for
End if
end if
Next
 

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

Top