Hi All,
I am in a quandary over how to implement cell protection. It is common knowledge that for protection to work the cells must be locked and the worksheet protected. Well, when I try to implement cell protection using the following code:
Sub Worksheet_Activate
ActiveSheet.Protect UserInterfaceOnly:=True, password:="password"
End Sub
Either the target cells remain locked and a "Run-time error 1004' occurs and the macro stops, or the macro executes and leaves the target cells unlocked (and I'd like them to be locked with the macro has executed).
Can anyone shed light on this quandary? How can I acheive my objective of protecting the cell contents? It has been suggested that I set the sheets scroll area, however, this solution does not work for my situation.
Also, is there a way to lock cell after it has been unprotected?
Any help that I could get on this will be greatly appreciated!
Thanks,
Chris
I am in a quandary over how to implement cell protection. It is common knowledge that for protection to work the cells must be locked and the worksheet protected. Well, when I try to implement cell protection using the following code:
Sub Worksheet_Activate
ActiveSheet.Protect UserInterfaceOnly:=True, password:="password"
End Sub
Either the target cells remain locked and a "Run-time error 1004' occurs and the macro stops, or the macro executes and leaves the target cells unlocked (and I'd like them to be locked with the macro has executed).
Can anyone shed light on this quandary? How can I acheive my objective of protecting the cell contents? It has been suggested that I set the sheets scroll area, however, this solution does not work for my situation.
Also, is there a way to lock cell after it has been unprotected?
Any help that I could get on this will be greatly appreciated!
Thanks,
Chris