Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
umm maybe that only works on forms you could try this
public norepeat as integer 'put at top of module Private Sub CheckBox1_Click() if norepeat = 1 then exit sub norepeat = 1 If Range("OBRStatus").Value = "LOCKED" Then If CheckBox1.Value Then CheckBox1.Value = False Else CheckBox1.Value = True End If End If norepeat = 0 End Sub -- When you lose your mind, you free your life. "Kingnothing" wrote: In an excel sheet, I have 30~40 checkboxes. These CheckBoxes are not linked to any cells, the only purpose that they serve is to label certain aspects about a patient. i.e. A user would select CheckBox1 if they have hypertension, CheckBox2 if they have diabetes, so on and so forth. The CheckBoxes are only there to show certain aspects of a patient. I want to make it so that once all appropriate checkboxes have been set, that their value's are protected after the worksheet is protected. I have selected the locked property to be true, and after protecting the sheet a user can still modify the CheckBox's value. How can I prevent this? For more reasons than you want to know, setting the enable property to false is not an option. I had this idea, but it doesn't work. There exists a named cell "OBRStatus" that contians the text of "unlocked" or "locked" depending on the protection status of the sheet. I then wrote this macro: Private Sub CheckBox1_Click() If Range("OBRStatus").Value = "LOCKED" Then If CheckBox1.Value Then CheckBox1.Value = False Else CheckBox1.Value = True End If End If End Sub You would think that would work right? Just toggling the value back to it's original state if sheet is locked. Nope, here is what I found out after I placed a breakpoint at the If Range... After the CheckBox1.Value is changed, the functions goes to End Sub as it should, but then it restarts as though the toggling of the value envoked another CheckBox1_Click event. If anyone has any ideas on how I can solve this problem please let me know. Thanks, Clay Rose |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to lock the Ctrl key? (as locking the Shift key w/Caps Lock) | Excel Discussion (Misc queries) | |||
how do I undo the scroll lock, thscroll lock button does not work | Excel Discussion (Misc queries) | |||
How to have Checkbox A uncheck with checked Checkbox B | Excel Discussion (Misc queries) | |||
I have lock a wookbook but one cell does not want to lock it | Excel Discussion (Misc queries) | |||
Checkbox Lock | Excel Programming |