To lock a cell/cells after entering the value

T

The learner

I am doing a time sheet for my staff to allow them enter "Time in" and "time
out" in the begining and end of the working day. My question is ; is there
any way to do so they can only do one entery on the cell and not be able to
change it later?
 
G

Gary''s Student

1. First un-protect the sheet

2. Next un-protect the cells:
Format > Cells... > Protection > and clear the Locked checkbox

3. Next protect the sheet:
Tools > Protection > Protect Sheet > and have only select unlocked cells
checked

4. Put the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
ActiveSheet.Unprotect
t.Locked = True
t.FormulaHidden = False
ActiveSheet.Protect Contents:=True
ActiveSheet.Protect
End Sub

Once a value has been entered in the sheet, its value will be locked
 
Top