|
本帖最后由 鲸落52 于 2022-2-19 13:36 编辑
能力有限,不清楚法定节假日,只能写出g1和g2的
Sub test()
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
For j = 2 To UBound(arr, 2) - 4
If Application.Weekday("2021/" & Application.Text(Application.Substitute(arr(1, j), ".", "/"), "mm/dd")) - 1 <> 6 And _
Application.Weekday("2021/" & Application.Text(Application.Substitute(arr(1, j), ".", "/"), "mm/dd")) - 1 <> 0 Then
If arr(i, j) > 8 Then
arr(i, 34) = arr(i, 34) + (arr(i, j) - 8)
End If
Else
arr(i, 35) = arr(i, 34) + (arr(i, j) - 8)
End If
Next
Next
[a1].CurrentRegion = arr
End Sub
|
|