i found the solution code for counting workdays between 2 dates:
Dim dif As Integer
Dim i As Integer
Dim dCount As Integer
Dim midTemp
StartDate = "01/05/2004"
enddate = "01/15/2005" '
dCount = 1
dif = DateDiff("d", Startdate, enddate, vbMonday, vbFirstJan1)
For i = 1 To dif
midTemp = DateAdd("d", i, Startdate)
If Weekday(midTemp, vbMonday) < 6 Then
dCount = dCount + 1
End If
Next i
print dCount
|