ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Time Clock - Making sure they clock out (https://www.excelbanter.com/excel-programming/412013-time-clock-making-sure-they-clock-out.html)

Valiant

Time Clock - Making sure they clock out
 
Hi,
I currently have a macro running a time clock like function utalizing Excel
and I was wondering, is there any way to make it so when a worker hits the
start button for starting a new job, the computer checks to be sure that
their time was entered for ending the previous job? If it wasn't ended, I
was hoping it could insert the current time into the end of the previous job
before going through the macro starting the new one. Thanks for the help.

Valiant

Time Clock - Making sure they clock out
 
My current code for the start button is:
Sub TimeStampStart()
Const TimeStampColumn As String = "D"
Const PWORD As String = ""
ActiveSheet.Unprotect PWORD
Dim X As Long
Dim LastUsedRow As Long
With ActiveSheet
LastUsedRow = .Cells(Rows.Count, TimeStampColumn).End(xlUp).Row
.Cells(LastUsedRow - (.Cells(LastUsedRow, TimeStampColumn). _
Value < ""), TimeStampColumn).Value = Now
End With

Const DateStampColumn As String = "A"
Dim Y As Long
Dim LastUnusedRow As Long
With ActiveSheet
LastUnusedRow = .Cells(Rows.Count, DateStampColumn).End(xlUp).Row
If .Cells(LastUnusedRow, DateStampColumn).Value < "" Then
LastUnusedRow = LastUnusedRow + 1
End If
.Cells(LastUnusedRow, DateStampColumn).Value = Date
.Cells(LastUnusedRow, TimeStampColumn).Value = Time
End With
ActiveSheet.Protect PWORD
ActiveWorkbook.Save

End Sub

I hope this might help answer my question. I was thinking some sort of if
statement in the early part to check if there is something in the end column
( column F) and if there isn't, insert the current time in there, than
proceed onward. Is there a way to do that? Thanks for any and all help you
can offer.

"valiant" wrote:

Hi,
I currently have a macro running a time clock like function utalizing Excel
and I was wondering, is there any way to make it so when a worker hits the
start button for starting a new job, the computer checks to be sure that
their time was entered for ending the previous job? If it wasn't ended, I
was hoping it could insert the current time into the end of the previous job
before going through the macro starting the new one. Thanks for the help.



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

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