Public Function WeekDayCount(firstDate As Date, LastDate As Date) As Integer
'计算工作日天数
On Error GoTo Err:
Dim i As Integer
Dim TempDate As Date '临时日期
Dim Tempts As Long
Tempts = DateDiff("d", firstDate, LastDate)
For i = 0 To Tempts
TempDate = DateAdd("d", i, firstDate)
Select Case Format(TempDate, "w")
Case 2, 3, 4, 5, 6
WeekDayCount = WeekDayCount + 1
End Select
Next
Err:
Exit Function