Hi,
I am trying to enable or disable an ActiveX Controls CheckBox depending on whether a value in an adjacent cell is greater or less than or equal to 0. The CheckBox would be enabled if the value is greater than 0 and disabled if the value is less than or equal to 0.
I found this thread (http://www.mrexcel.com/forum/excel-questions/420586-disable-checkbox-visual-basic-applications.html) and changed the code to one that would read the value from an adjacent cell.
The code I have so far is:
The checkbox disables when I input a value less than or equal to 0 in cell C22 but when I then input a value greater than 0 into cell C22 the cell remains disabled instead of becoming enabled again. The only way for me to enable the cell again is to hit the F8 key multiple times in the VBA.
How can I get the checkbox to change from disabled to enabled based on a cell value after it has been disabled?
Thanks
I am trying to enable or disable an ActiveX Controls CheckBox depending on whether a value in an adjacent cell is greater or less than or equal to 0. The CheckBox would be enabled if the value is greater than 0 and disabled if the value is less than or equal to 0.
I found this thread (http://www.mrexcel.com/forum/excel-questions/420586-disable-checkbox-visual-basic-applications.html) and changed the code to one that would read the value from an adjacent cell.
The code I have so far is:
Code:
Private Sub CB1_Change()
Select Case Range("C22").Value > 0
Case True: CB1.Enabled = True
Case False: CB1.Enabled = False
End Select
End Sub
The checkbox disables when I input a value less than or equal to 0 in cell C22 but when I then input a value greater than 0 into cell C22 the cell remains disabled instead of becoming enabled again. The only way for me to enable the cell again is to hit the F8 key multiple times in the VBA.
How can I get the checkbox to change from disabled to enabled based on a cell value after it has been disabled?
Thanks