I found a short piece of code on the internet to calculate the number of workdays between two dates, and created the following function:
Function WORKDAYS(StartDate As Date, EndDate As Date) As Variant
Dim j As Variant
Do Until StartDate = EndDate
If Not (Weekday(StartDate) = vbSaturday Or Weekday(StartDate) = vbSunday) Then
j = j + 1
End If
StartDate = StartDate + 1
Loop
WORKDAYS = j
End Function
I need to amend this code so that it does not count a day, if it is in a list of holidays (which can be stated within the code.)
I'm aware of the function NetworkdaysIntl, but I need to create this anyway as I have many holiday schedules I need to manipulate.
Bookmarks