Thread: optionbutton
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default optionbutton

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


--
Regards,
Tom Ogilvy


"benb" wrote in message
...
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.