|
我们倒班时间是01:30-08:30,08:30-16:30,16:30-01:30
VBA原有程序是如下(00:30-08:30,08:30-16:30,16:30-00:30固定8小时倒班的),我应该怎么改才能让倒班时间7、8、9小时在程序里继续循环呢
Sub rqybc(R1, R3)
Dim Date01 As Date
If TimeValue(R1) = TimeValue("00:30") Then
Select Case (R1 Mod 8)
Case 0
R3.Value = 3
Case 1
R3.Value = 2
Case 2
R3.Value = 2
Case 3
R3.Value = 1
Case 4
R3.Value = 1
Case 5
R3.Value = 4
Case 6
R3.Value = 4
Case 7
R3.Value = 3
End Select
ElseIf TimeValue(R1) = TimeValue("08:30") Then
Select Case ((R1 - 1 / 3) Mod 8)
Case 0
R3.Value = 4
Case 1
R3.Value = 4
Case 2
R3.Value = 3
Case 3
R3.Value = 3
Case 4
R3.Value = 2
Case 5
R3.Value = 2
Case 6
R3.Value = 1
Case 7
R3.Value = 1
End Select
ElseIf TimeValue(R1) = TimeValue("16:30") Then
Select Case ((R1 - 2 / 3) Mod 8)
Case 0
R3.Value = 1
Case 1
R3.Value = 1
Case 2
R3.Value = 4
Case 3
R3.Value = 4
Case 4
R3.Value = 3
Case 5
R3.Value = 3
Case 6
R3.Value = 2
Case 7
R3.Value = 2
End Select
End If
End Sub |
|