Keep people from changing time in and time out

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
I have an old computer at work. We are going to use it as our time clock. I want them to enter their time in and out themselves. However, once they entered their time, I don't want them to be able to change it. Is there something I can do to prevent this? If so, I would need a manager to be able to edit it as needed.

Any ideas?

Thank You,
Michael
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hello, Michael,

can you start with something like this ?
Code:
Option Explicit

Dim flag As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
'Erik Van Geit
'051124
'freeze entries
If flag = True Then Exit Sub
If Target.Count > 1 Then GoTo skip
If MsgBox("do you confirm this entry ?" & Chr(10) & Format(Target, "hh:mm:ss"), 292, "PLEASE CONFIRM") = vbNo Then GoTo skip
    
    Me.Unprotect "password"
    Target.Locked = True
    Me.Protect "password"

Exit Sub
skip:
flag = True
Application.Undo
flag = False
End Sub
TO INSTALL IN SHEET CODE WINDOW:
1. right click the "Name Tab" of sheet you want code to work in
2. Select "View Code" in drop down menu
3. VBE window will open ... paste code in and exit VBE

all entry cells must be unlocked to start and will be "frozen" one by one

kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,119,002
Messages
5,575,501
Members
412,670
Latest member
Khin Zaw Htwe
Top