PDA

View Full Version : Check boxes -- only one click



dmkitz
09-22-2006, 08:00 AM
In Excel 2000, I am working on a form with check boxes. I wrote the following code in the click event so that only one box (either Yes or No) would be checked at a time. However, if Yes is checked, you have to double-click No (instead of clicking it only once) to activate that box. Can I get that in a single click? Or is there a different way to accomplish the task? They don't need to return a value. Thanks.


Private Sub ChkLitYes_Click()
ChkLitNo.Value = 0
End Sub

mdmackillop
09-22-2006, 08:32 AM
Why not use option buttons. They are designed for this interaction.

dmkitz
09-22-2006, 08:53 AM
They need to look like check boxes.

Bob Phillips
09-22-2006, 09:11 AM
Why?

malik641
09-22-2006, 09:39 AM
I don't know what you mean by getting a double-click action on a single click....but I think you're looking for something like this:

Private Sub chkNo_Click()
If chkYes.Value <> 0 Then
chkNo.Value = 0
End If
End Sub

Private Sub chkNo_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
chkYes.Value = 0
End Sub

Private Sub chkYes_Click()
chkNo.Value = 0
End Sub