|
Sub 计算工时()
' https://club.excelhome.net/thread-1663419-1-1.html
' 2023-5-23
x1 = 7
Do While Not (IsEmpty(Sheet1.Cells(x1, 4).Value))
If Sheet1.Cells(x1, 6).Value < Sheet1.Cells(x1, 5).Value Then
xs = 24 + Hour(Sheet1.Cells(x1, 6).Value) - Hour(Sheet1.Cells(x1, 5).Value)
Else
xs = Hour(Sheet1.Cells(x1, 6).Value) - Hour(Sheet1.Cells(x1, 5).Value)
End If
fz = Minute(Sheet1.Cells(x1, 6).Value) - Minute(Sheet1.Cells(x1, 5).Value)
If fz < 0 Then
xs = xs - 1
fz = fz + 60
End If
Sheet1.Cells(x1, 7).Value = xs & "时" & fz & "分"
Sheet1.Cells(x1, 8).Value = ((xs - 8) * 60 + fz) / 60
Sheet1.Cells(x1, 9).Value = (xs - 8) * 60 + fz
x1 = x1 + 1
Loop
End Sub |
评分
-
1
查看全部评分
-
|