Public Function DateDiff(Interval As String, Date1, Date2, Optional FirstDayOfWeek As VbDayOfWeek = vbSunday, Optional FirstWeekOfYear As VbFirstWeekOfYear = vbFirstJan1) As Variant
Dim nStep As Integer
Dim dLoop As Date
If StrComp(Interval, "WD", vbTextCompare) Then
DateDiff = VBA.DateDiff(Interval, Date1, Date2, FirstDayOfWeek, FirstWeekOfYear)
Else
nStep = Sgn(Date2 - Date1)
If nStep Then
For dLoop = Date1 + nStep To Date2 Step nStep
If Not IsHoliday(dLoop) Then
DateDiff = DateDiff + nStep
End If
Next dLoop
Else
DateDiff = 0
End If
End If
End Function