PDA

View Full Version : [SOLVED] Protect/Unprotect



blackie42
10-29-2016, 09:24 AM
Hi,

Using following to lock a column & prevent additional rows columns being created.


Private Sub protectit()

Cells.Locked = False
Range("A1:A2000").Locked = True

ActiveSheet.Protect AllowInsertingRows:=False, AllowInsertingColumns:=False

ActiveSheet.Protect Password:="Test"

End Sub

However just selecting 'unprotect sheet' on ribbon deactivates without asking for password.

Any ideas?

thanks
Jon

p45cal
10-29-2016, 09:44 AM
Private Sub protectit()
Cells.Locked = False
Range("A1:A2000").Locked = True
ActiveSheet.Protect Password:="Test", AllowInsertingRows:=False, AllowInsertingColumns:=False
End Sub

blackie42
10-29-2016, 11:05 AM
Cheers P45,

Works fine

regards
Jon