Excel - Check Boxes need clicking twice
Discussion
From the ActiveX Control I have 5 Check Boxes. I want clicking one of these to check the box and uncheck the other four and change the value of a specific cell. I've added this code:
Private Sub CheckBox2_Click()
If CheckBox2 = True Then Range("A5") = 1
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox1_Click()
If CheckBox1 = True Then Range("A5") = 2
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox3_Click()
If CheckBox3 = True Then Range("A5") = 4
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox6_Click()
If CheckBox6 = True Then Range("A5") = 5
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox2.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox7_Click()
If CheckBox7 = True Then Range("A5") = 3
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox2.Value = False
End Sub
Now, clicking any of the the checkboxes changes the cell value, but you have to click it again to get the box checked. What's that all about?
In terms of making the spreadsheet work, it's just a cosmetic thing, but it would be better if it worked properly!
Cheers
Private Sub CheckBox2_Click()
If CheckBox2 = True Then Range("A5") = 1
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox1_Click()
If CheckBox1 = True Then Range("A5") = 2
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox3_Click()
If CheckBox3 = True Then Range("A5") = 4
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox6.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox6_Click()
If CheckBox6 = True Then Range("A5") = 5
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox2.Value = False
CheckBox7.Value = False
End Sub
Private Sub CheckBox7_Click()
If CheckBox7 = True Then Range("A5") = 3
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox6.Value = False
CheckBox2.Value = False
End Sub
Now, clicking any of the the checkboxes changes the cell value, but you have to click it again to get the box checked. What's that all about?
In terms of making the spreadsheet work, it's just a cosmetic thing, but it would be better if it worked properly!
Cheers
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


