Time Clock - Making sure they clock out

V

valiant

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.
 
V

valiant

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.
 

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

Top