Protecting a sheet does nothing if cells are not set as Locked.
First, cells you want to restrict must have Locked set. Then turn Protection on or off.
Allowing selection of locked or unlocked cells is a feature of Protection. Right click on sheet tab then click ProtectSheet to view options.
A locked cell is read only when Protection is on. It can be selected but attempting to type in it will trigger message.
Code to protect/unprotect is simple.
Just Protect or Unprotect will act on sheet that is active. Prefix with sheet name if you want to specify.
However, there is nothing preventing any user to right click > unprotect unless you want to encrypt with password.Worksheets("sheetname").Protect
By "shared" do you mean all user edits are supposed to be saved to same file?




Reply With Quote