Function CountDays(Date1,Date2)
On Error Resume Next
Err.Clear

da1=Date1
da2=Date2

DT1=FormatDateTime(Date1,2)
DT2=FormatDateTime(Date2,2)

Dim countNum
countNum=DateDiff("d",DT1,DT2)

For i=da1 to da2
If weekday(i)=1 or weekday(i)=7 Then
countNum=countNum-1
End If
Next

CountDays=countNum
End Function
posted on 2012-01-31 16:24  testerZH  阅读(209)  评论(0编辑  收藏  举报