大于一周的天数每周5天不用判断,下面是一个取得工作日的函数(不判断节假日):
Public Function WorkDays(BeginDate As Date, EndDate As Date) As Integer
Dim i As Integer
If EndDate < BeginDate Then Exit Function
WorkDays = (((EndDate - BeginDate) + 1) \ 7) * 5
For i = 0 To ((EndDate - BeginDate) + 1) Mod 7 - 1
'判断是否为星期六或星期天
If Weekday(EndDate - i, vbSaturday) <> 1 And _
Weekday(EndDate - i, vbSaturday) <> 2 Then
WorkDays = WorkDays + 1
End If
Next
End Function