View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Check if a optionbutton is selected

sorry, there is a typo in the first line:
Dim Optionbutton As Control


--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
maybe something like this, change userform1 to your userform name

Dim optionbuttom As Control
For Each OptionButton In UserForm1.Controls
If OptionButton.Value = True Then
MsgBox OptionButton.Caption & " = True"
End If
Next

--


Gary


"Gert-Jan" wrote in message
.. .
Hi Martin,

Thanks, but I know what I have to do. Isn't there a way to do this simple and
fast (not depending on the number of optionbuttons)?

Gert-Jan

"Martin Fishlock" schreef in bericht
...
Hi,

You need to check each of the buttons for true.

Another way is to seta default for button1 to true in the form design (or at
initialization).

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Gert-Jan" wrote:

Hi,

In a userform I use three optionbuttons. One of them must be selected by
the
user. How can let VBA check if this is done?

Regards, Gert-Jan