|
Sub kaoqin()
ks = "8:00:00"
js = "17:00:00"
With Sheets("1_attlog")
r = .Cells(Rows.Count, 1).End(xlUp).Row
.Range("c2:f" & r) = Empty
ar = .Range("a1:f" & r)
For i = 2 To UBound(ar)
If Trim(ar(i, 2)) <> "" Then
ar(i, 3) = Format(ar(i, 2), "yyyy/mm/dd")
ar(i, 4) = Format(ar(i, 2), "h:mm:ss")
If TimeValue(ar(i, 4)) > TimeValue(ks) And TimeValue(ar(i, 4)) < TimeValue("12:00:00") Then
ar(i, 5) = "迟到"
ElseIf TimeValue(ar(i, 4)) > TimeValue("12:00:00") And TimeValue(ar(i, 4)) < TimeValue(js) Then
ar(i, 5) = "早退"
ElseIf TimeValue(ar(i, 4)) > TimeValue(js) Then
ar(i, 6) = Format(TimeValue(ar(i, 4)) - TimeValue(js), "h:mm:ss")
End If
End If
Next i
.Range("a1:f" & r) = ar
End With
End Sub
|
|