Hello. I have an ongoing problem. I am trying to lock cells so they
cannot be changed as long as a checkbox on the active sheet is checked.
I have some code, but it runs an error and doesn't quite work anyway.
I have another macro that fills the boxes with values, but I want the
users to be able to adjust those values. Only after the checkbox is
checked, I want the access to those cells to be locked. Here is a
sampling of the code I have so far:
Sub chkLockAttribs_Click()
'
'Private Sub chkLockAttribs_Click()
Dim myRng As Range
Dim myPwd As String
myPwd = "secret"
Set myRng = ActiveSheet.Range("C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35")
ActiveSheet.Unprotect Password:=myPwd
myRng.Locked =
ActiveSheet.OLEObjects("chkLockAttribs").Object.Value
ActiveSheet.cmdRoll.Visible = Not
(ActiveSheet.chkLockAttribs.Value)
ActiveSheet.Protect Password:=myPwd
End Sub
The checkbox is chkLockAttribs and the button linked to a macro
generating values is cmdRoll. C18, D19:D23, D25, D26:F26, J19:J23,
P33, P35 is the range of cells I want to lock after the checkbox is
checked. I don't really need a password protection on this. It's more
a convienence thing.
So any suggestions? Any and all help appreciated.
-SplatterKat-
aka -Robert Lizak-
Bookmarks