ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active X Checkboxes (https://www.excelbanter.com/excel-programming/327696-active-x-checkboxes.html)

Holanmeg

Active X Checkboxes
 
Is there any way of making check boxes work in the same way as radio buttons,
i.e. making it possible to be able to only have one box ticked in a group.
You may say use radio buttons, but the users of the form I am constructing
would prefer to have tick boxes.
Many thanks for any assistance.

Harald Staff

Active X Checkboxes
 
Hi

You can change checkbox values by code. Try this:

Private Sub CheckBox1_Click()
Me.CheckBox2.Value = Not (Me.CheckBox1.Value)
End Sub

Private Sub CheckBox2_Click()
Me.CheckBox1.Value = Not (Me.CheckBox2.Value)
End Sub

HTH. Best wishes Harald

"Holanmeg" skrev i melding
...
Is there any way of making check boxes work in the same way as radio

buttons,
i.e. making it possible to be able to only have one box ticked in a group.
You may say use radio buttons, but the users of the form I am constructing
would prefer to have tick boxes.
Many thanks for any assistance.




Holanmeg

Active X Checkboxes
 
Thanks. This works for two checkboxes, but I cannot make it work for more
than two. I tried including more lines of the same code but with different
box references, under each Sub routine for three boxes.


"Harald Staff" wrote:

Hi

You can change checkbox values by code. Try this:

Private Sub CheckBox1_Click()
Me.CheckBox2.Value = Not (Me.CheckBox1.Value)
End Sub

Private Sub CheckBox2_Click()
Me.CheckBox1.Value = Not (Me.CheckBox2.Value)
End Sub

HTH. Best wishes Harald

"Holanmeg" skrev i melding
...
Is there any way of making check boxes work in the same way as radio

buttons,
i.e. making it possible to be able to only have one box ticked in a group.
You may say use radio buttons, but the users of the form I am constructing
would prefer to have tick boxes.
Many thanks for any assistance.





Harald Staff

Active X Checkboxes
 
First allow me to say that this is a really silly idea. The customer wants
something to bark and scare off thieves, but dogs are ugly and smelly, so
the customer wants it to be a pussycat. So how do we teach a pussycat to
bark, and how do we make thieves afraid of them ? We require it. Customers
are not always right. But see if this works for you, the technique is useful
anyway:

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
CheckBox2.Value = False
CheckBox3.Value = False
End If
End Sub

Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then
CheckBox1.Value = False
CheckBox3.Value = False
End If
End Sub

And so on.

HTH. Best wishes Harald

"Holanmeg" skrev i melding
...
Thanks. This works for two checkboxes, but I cannot make it work for more
than two. I tried including more lines of the same code but with

different
box references, under each Sub routine for three boxes.


"Harald Staff" wrote:

Hi

You can change checkbox values by code. Try this:

Private Sub CheckBox1_Click()
Me.CheckBox2.Value = Not (Me.CheckBox1.Value)
End Sub

Private Sub CheckBox2_Click()
Me.CheckBox1.Value = Not (Me.CheckBox2.Value)
End Sub

HTH. Best wishes Harald

"Holanmeg" skrev i melding
...
Is there any way of making check boxes work in the same way as radio

buttons,
i.e. making it possible to be able to only have one box ticked in a

group.
You may say use radio buttons, but the users of the form I am

constructing
would prefer to have tick boxes.
Many thanks for any assistance.








All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com