I am trying to find a code that will lock the cell after data entry, but not the entire sheet.
I want people to be able to enter data in empty cells, but not delete or edit completed cells.
Is there a way to do this?
I know I can lock the particular cells manually, but I want them to lock automatically.
Please help!
Thank you.
First unlock all the cells on the sheet
then protect the sheet.
Put this code in the sheet's code module:Code:Private Sub Worksheet_Change(ByVal Target As Range) Me.Protect userinterfaceonly:=True For Each cll In Target.Cells If Not IsEmpty(cll.Value) Then cll.Locked = True Next cll End Sub
Bookmarks