ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clickbox control help needed (https://www.excelbanter.com/excel-programming/407643-clickbox-control-help-needed.html)

BrianG[_3_]

Clickbox control help needed
 
I would am attempting to create two clickboxes where when one is
turned On the other is turned Off automatically. No luck so far. Any
suggestions would be appreciated. Below are two of the codes I have
tried.

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

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

AND

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

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


TIA,

BrianG

Jim Thomlinson

Clickbox control help needed
 
Why not use radio buttons (small circles) as they are designed specifically
to be mutually exclusive (only one can be selected at a time).
--
HTH...

Jim Thomlinson


"BrianG" wrote:

I would am attempting to create two clickboxes where when one is
turned On the other is turned Off automatically. No luck so far. Any
suggestions would be appreciated. Below are two of the codes I have
tried.

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

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

AND

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

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


TIA,

BrianG


BrianG[_3_]

Clickbox control help needed
 
I'm trying to use clickboxes because the look of the clickbox on the
printed form is preferable to that of the radio button. Of course, if
I can't control the clickboxes I'll need to consider other options.


BrianG

Jim Thomlinson

Clickbox control help needed
 
You can try this...

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

Private Sub CheckBox3_Click()
If CheckBox3.Value = True Then
CheckBox1.Value = False
CheckBox2.Value = False
End If
End Sub
--
HTH...

Jim Thomlinson


"BrianG" wrote:

I'm trying to use clickboxes because the look of the clickbox on the
printed form is preferable to that of the radio button. Of course, if
I can't control the clickboxes I'll need to consider other options.


BrianG


BrianG[_3_]

Clickbox control help needed
 
That did it. Many thanks Jim.


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

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