One way to approach this would be the Non-Fancy (free of charge/off the
top of my head) way. First you have to get the number of months between
the 2 dates
Sub GetDayCounts()
Dim....
sDate = StartDate
m = DateDiff("m", EndDate, StartDate)
For i = 1 to m - 1
str1 = Month(sDate) & "/1/" & Year(sDate)
eDate = str1
eDate = DateAdd("m", 1, eDate) - 1
n = DateDiff("d", eDate, sDate)
for j = 0 to n - 1
nDate = DateAdd("d", j, sDate)
If WeekDay(nDate) <> 0 And WeekDay(nDate) <> 7 Then
If Not fcnHolidays(nDate) Then
DayCount = DayCount + 1
End If
End If
Next
Debug.Print "Number of non-holiday weekdays between " _
& sDate & " and " & edate & " is " & DayCount
DayCount = 0
sDate = eDate + 1 'start next month
Next
n = DateDiff("d", EndDate, sDate) 'get last month count
for j = 0 to n - 1
nDate = DateAdd("d", j, sDate)
If WeekDay(nDate) <> 0 And WeekDay(nDate) <> 7 Then
If Not fcnHolidays(nDate) Then
DayCount = DayCount + 1
End If
End If
Next
Debug.Print "Number of non-holiday weekdays between " _
& sDate & " and " & EndDate & " is " & DayCount
End Sub
Function fcnHolidays(n As Date) As Boolean
fcnHolidays = False
Select Case n
Case #2/14/03# : fcnHolidays = True
Case #7/4/03# : fcnHolidays = True
Case #9/2/03# : fcnHoldidays = True
...
End Select
End Function
I obviously made up the holidays in the holiday function, but hopefully
you get the idea of one way to do this.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!