You will need a list of vacation dates with which you can compare. You will need to create and store this list separately. You did not say which version of VB (VBA? VB.NET?), But in VB.NET you could do:
Dim datevalue As DateTime = New DateTime(DateTime.Year, DateTime.Month, 1)
Dim dayIsFound As Boolean = False
Dim workDays As Integer
workDays = 1
While Not dayIsFound
If ( dateValue.DayOfWeek <> DayOfWeek.Saturday _
And dateValue.DayOfWeek <> DayOfWeek.Sunday _
And Not HolidayList.Contains( dateValue ) _
workDays = workDays + 1
End If
If index >= 5 Then
dayIsFound = True
Else
dateValue = dateValue.AddDays(1)
End If
End While
Technically, you can build an algorithm that determines the main holidays based on federal recommendations (in the USA), but this is difficult and may not correspond to the holidays of the company you are building this component.
source
share