ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   To lock a cell/cells after entering the value (https://www.excelbanter.com/excel-discussion-misc-queries/174573-lock-cell-cells-after-entering-value.html)

The learner

To lock a cell/cells after entering the value
 
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?

Gary''s Student

To lock a cell/cells after entering the value
 
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
--
Gary's Student - gsnu200766


"The learner" wrote:

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?



All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com