Function DayCount(DateBeg As Date, DateEnd As Date, Optional D1 As Integer, Optional D2 As Integer, Optional D3 As Integer, Optional D4 As Integer, Optional D5 As Integer, Optional D6 As Integer, Optional D7 As Integer)
For i = 0 To DateEnd - DateBeg If Weekday(DateBeg + i) = D1 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D2 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D3 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D4 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D5 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D6 Then Cnt = Cnt + 1 Else End If
If Weekday(DateBeg + i) = D7 Then Cnt = Cnt + 1 Else End If
Next i
DayCount = Cnt
End Function
No comments:
Post a Comment