To lock a cell/cells after entering the value

  • Thread starter Thread starter The learner
  • Start date Start date
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top