Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Lock Checkbox value

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Lock Checkbox value


--
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


don't use the enable propery, use the locked property does not go dark but
you can not manually change them
BEn

  #3   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Lock Checkbox value

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to lock the Ctrl key? (as locking the Shift key w/Caps Lock) Rick-cel Excel Discussion (Misc queries) 2 August 5th 09 06:45 PM
how do I undo the scroll lock, thscroll lock button does not work scroll lock Excel Discussion (Misc queries) 3 July 19th 08 10:17 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
I have lock a wookbook but one cell does not want to lock it Mimi Excel Discussion (Misc queries) 1 January 21st 07 09:44 AM
Checkbox Lock Leanne Excel Programming 3 January 11th 05 02:34 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"