Check boxes & protection

  • Thread starter Thread starter rob nobel
  • Start date Start date
R

rob nobel

I have 4 check boxes with some code to uncheck 3 boxes if 1 is selected as
follows:
If CheckBox1 = True Then CheckBox2 = False
If CheckBox1 = True Then CheckBox3 = False
If CheckBox1 = True Then CheckBox4 = False
If Range("o1") = 0 Then GoTo Finish
If CheckBox1 = True Then
MsgBox "If you are selecting a different quarter, make sure you have
selected the 'Finalise' button for the previous quarter (if that quarter's
BAS has been completed!)"
Else:
End If
Finish:
End Sub

I would like to protect this sheet, but can't seem to do it and still have
these checkboxes function (even if I insert the ActiveSheet.Unprotect and
ActiveSheet.Protect commands into this code).
Any ideas anyone?
Rob
 
Rob try using eg.

CheckBox2.Enabled = False to disable the checkboxes and CheckBox2.Enabled
=True to re-enable.

do this for each CheckBox in your Code.

Fred
 
Thanks for the suggestion Frederick.
But this does not solve my problem if I'm reading you right. The problem is
simply that I cannot protect the sheet and still use the Check boxes.
I want to incorporate, somehow, to unprotect the sheet as I click each
checkbox, and then after the checkbox is selected and performs it's
procedure, the sheet is protected again.
Can this be done within the code for the checkbox or is there a way to
overide this in another procedure like a Workbook_Open() event???
In other words, if a sheet is protected, how do you get a checkbox to
function?
Rob
 
Please, can someone suggest how I might be able to use a checkbox on a
protected worksheet. Is there a way at all? Sorry if someone has answered
this, but I can't see a reply (except from Frederick).
Rob
 
Right click on your checkbox.
Select Format control|Protection tab
uncheck locked.

(You'll have to go into design mode (icon on the controltoolbox toolbar) to do
this.)
 
Hi Dave,
Thanks for the suggestion, but I have already tried that and it doesn't work
for me.
Even if I put a check box on a new workbook, and protect the sheet and have
the locked option unchecked, it still won't do it. There is some code in
the check boxes I'm trying to do this with, but the test checkbox I just
created on the new workbook has no code whatsoever, just....
(Private Sub CheckBox1_Click()

End Sub

Rob
 
If your Check Box is linked to a certain cell, then the Locked property
for that cell must also be unlocked..
 
Dale.....Thanks so much for that. Quite obvious really but wasn't to me!
Works perfectly now and will save a lot of headache for the user of the
file.
Thanks again!
Rob
 
Back
Top