Option Boxes

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

With regards to option boxes, i cannot get the Triple
state to work. I need it as there may be an occasion when
someone initially clicks one of the options, but then
changes his/her mind, so needs to null both of them.
At the moment, i am setting triple state to True, but
getting the same effect as when it is set to false.

Any ideas?
 
Richard,

When an Checkbox has TripleState True, it will return either True, False, or
Null, and you need to check for the Null state first:

If IsNull(CheckBox1.Value) Then
MsgBox "It's null"
Exit Sub
End If
MsgBox "It's " & CheckBox1.Value

HTH,
Bernie
MS Excel MVP
 
Thanks Bernie. What i actually need though is more
straightforward. I just want the ability when runnign the
form to select one of the two option buttons, then make it
false again, without activating the other option button,
so ideally by clicking on it again. I thought this is what
TripleState did, but i may have been mistaken

Regards

Richard
 
Richard,

Are you using option buttons, or radio buttons? Radio buttons force a
single selection, which sounds like what is happening to you.

Triple state allows for a grey state, like you get if you select multiple
cells with different merging and use format to merge them all.

HTH,
Bernie
MS Excel MVP
 
I admit they look like radio buttons, but the code says
option buttons. originally i was using checkboxes with
code to force the other cell false if one was true, which
allowed for two false as well, but this method uses less
code, albeit i can't get it to work!

i think i may have to fudge my form to get around it.
 
Richard,

Sorry. Option Buttons in VB-speak == Radio Buttons in people speak.

To clear the option buttons (which you can't do simply by clicking them),
use a commandbutton labeled "Clear choices" with code like this

Private Sub CommandButton1_Click()
UserForm1.OptionButton1.Value = False
UserForm1.OptionButton2.Value = False
End Sub

HTH,
Bernie
MS Excel MVP
 

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

Back
Top