??? I have no idea.
I just copied the code below from a module and pasted it; then highlighted and clicked the hash/octothorpe (#) in the header to create code tags.
Code:
Public Function ISO_WorkdayDiff( _
ByVal datDateFrom As Date, _
ByVal datDateTo As Date) _
As Long
' Purpose: Calculate number of working days between dates datDateFrom and datDateTo.
' Assumes: 5 or 6 working days per week. Weekend is (Saturday and) Sunday.
'
' Limitation: *** Does not account for public holidays.***
'
' May be freely used and distributed.
' 1999-04-23. Gustav Brock, Cactus Data ApS, Copenhagen ' 2000-10-03. Constants added.
' Option for 5 or 6 working days per week added.
Const cbytWorkdaysOfWeek As Byte = 5
Dim bytSunday As Byte
Dim intWeekdayDateFrom As Integer
Dim intWeekdayDateTo As Integer
Dim lngDays As Long
Dim datDateTemp As Date
' Reverse dates if these have been input reversed.
10 On Error GoTo ISO_WorkdayDiff_Error
20 If datDateFrom > datDateTo Then
30 datDateTemp = datDateFrom
40 datDateFrom = datDateTo
50 datDateTo = datDateTemp
60 End If
' Find ISO weekday for Sunday.
70 bytSunday = WeekDay(vbSunday, vbMonday)
' Find weekdays for the dates.
80 intWeekdayDateFrom = WeekDay(datDateFrom, vbMonday)
90 intWeekdayDateTo = WeekDay(datDateTo, vbMonday)
' Compensate weekdays' value for non-working days (weekends).
100 intWeekdayDateFrom = intWeekdayDateFrom + (intWeekdayDateFrom = bytSunday)
110 intWeekdayDateTo = intWeekdayDateTo + (intWeekdayDateTo = bytSunday)
' Calculate number of working days between the two weekdays, ignoring number of weeks.
120 lngDays = intWeekdayDateTo - intWeekdayDateFrom - (cbytWorkdaysOfWeek * (intWeekdayDateTo < intWeekdayDateFrom))
' Add number of working days between the weeks of the two dates.
130 lngDays = lngDays + (cbytWorkdaysOfWeek * DateDiff("w", datDateFrom, datDateTo, vbMonday, vbFirstFourDays))
140 ISO_WorkdayDiff = lngDays
150 On Error GoTo 0
160 Exit Function
ISO_WorkdayDiff_Error:
170 MsgBox "Error " & err.number & " (" & err.Description & ") in procedure ISO_WorkdayDiff of Module Module5"
End Function
This site will accept an attached file in zip format.