Hello! I am new to the board and new to using VBA in Excel. Pardon me if I am not describing stuff well.
Anyway, I am currently working on building a break/lunch log sheet for my team that does not require my supervision. Currently, everyone has this log sheet printed and I have to sign and validate the start/end time of their break time, to identify those who are exceeding their given break schedule.
My requirement:
* They should only be allowed to enter their time stamp (both start and end) using a Command button.
* Manual manipulation should not be allowed (like entering the time stamp manually)
* Prevent edits on previous time stamp entries
What I have accomplished:
I have done the 1st 2 requirements. My issue is the 3rd one. I was able to prevent manual manipulation by locking all cells and make the command button click unlock the cells using the script. This is what I have currently.
Private Sub CommandButton1_Click()
Dim emptyRow As Long
ActiveSheet.Unprotect
ActiveCell = Now()
ActiveCell.Select
ActiveCell.Value = Time
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks in advance!
Anyway, I am currently working on building a break/lunch log sheet for my team that does not require my supervision. Currently, everyone has this log sheet printed and I have to sign and validate the start/end time of their break time, to identify those who are exceeding their given break schedule.
My requirement:
* They should only be allowed to enter their time stamp (both start and end) using a Command button.
* Manual manipulation should not be allowed (like entering the time stamp manually)
* Prevent edits on previous time stamp entries
What I have accomplished:
I have done the 1st 2 requirements. My issue is the 3rd one. I was able to prevent manual manipulation by locking all cells and make the command button click unlock the cells using the script. This is what I have currently.
Private Sub CommandButton1_Click()
Dim emptyRow As Long
ActiveSheet.Unprotect
ActiveCell = Now()
ActiveCell.Select
ActiveCell.Value = Time
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks in advance!