Ok I wrote up a macro that can lock cells using the following
Private Sub Lock_Click()
Sheets("Raw Assay").Protect UserInterFaceOnly:=True, Password:="Password"
Sheets("Raw Assay").Range("C6:D53").Locked = True
Sheets("Raw Assay").Range("J6:L53").Locked = True
Sheets("Raw Assay").Range("D1:F1").Locked = True
Sheets("Raw Assay").Range("K1").Locked = True
End Sub
Private Sub Unlock_Click()
Sheets("Raw Assay").Protect UserInterFaceOnly:=True
Sheets("Raw Assay").Range("C6:D53").Locked = False
Sheets("Raw Assay").Range("J6:L53").Locked = False
Sheets("Raw Assay").Range("D1:F1").Locked = False
Sheets("Raw Assay").Range("K1").Locked = False
End Sub
###
The code will lock the cells just fine as well as unlock them. The problem is that I want it to require the password to unlock the cells. I thought passing this into the lock and not the unlock would suffice but the password given to lock the cells doesn't seem to apply. Any suggestions?
Thanks
Private Sub Lock_Click()
Sheets("Raw Assay").Protect UserInterFaceOnly:=True, Password:="Password"
Sheets("Raw Assay").Range("C6:D53").Locked = True
Sheets("Raw Assay").Range("J6:L53").Locked = True
Sheets("Raw Assay").Range("D1:F1").Locked = True
Sheets("Raw Assay").Range("K1").Locked = True
End Sub
Private Sub Unlock_Click()
Sheets("Raw Assay").Protect UserInterFaceOnly:=True
Sheets("Raw Assay").Range("C6:D53").Locked = False
Sheets("Raw Assay").Range("J6:L53").Locked = False
Sheets("Raw Assay").Range("D1:F1").Locked = False
Sheets("Raw Assay").Range("K1").Locked = False
End Sub
###
The code will lock the cells just fine as well as unlock them. The problem is that I want it to require the password to unlock the cells. I thought passing this into the lock and not the unlock would suffice but the password given to lock the cells doesn't seem to apply. Any suggestions?
Thanks