protect sheet/cells

Mstest / Awrdacpi
August 19, 2011 at 03:06:07
Specs: Microsoft Windows XP Professional, 2 GHz / 958 MB
This is the scenario.
In sheet 1 I have my summary where in I can add details but I do not want my previous data to be changed/edited.

It's as simple as I want my previous data to be protected but still can add more data from the last blank cell down.


See More: protect sheet/cells

Report •

August 19, 2011 at 18:41:04
Click in the box above the row numbers to select all cells.

Format...Cells...Protection tab...uncheck the Locked option.

Right click the sheet tab for the sheet and choose View Code.

Paste this into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
    ActiveSheet.Unprotect Password:="secret"
     Target.Locked = True
    ActiveSheet.Protect Password:="secret"
End Sub

If a cell in a Protected sheet is not locked, it is not Protected. Therefore, even if the sheet is Protected, users can still enter data in the unlocked cells.

The Worksheet_Change code above will un-Protect the sheet, Lock the cell(s) that was(were) changed and then Protect the sheet again.

Once they are Locked, users can't enter data in those cells until the sheet is un-Protected. All other unlocked cells can still be edited - but just once.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •
Related Solutions

Ask Question