README.md

December 4, 2022 ยท View on GitHub

RemoveWeekEnds

Description

Returns number of business days from a start date and total number of days. There are more pieces coming. Building a routine that calculates holidays and weekends to tell you strictly business days.

More Info

strStartDate and totalsdays

total number of business days

Submitted On
ByUstes
LevelBeginner
User Rating4.7 (14 globes from 3 users)
CompatibilityVB 5.0, VB 6.0
CategoryMath/ Dates
WorldVisual Basic
Archive File

Source Code

Public Function RemoveWeekends(strStartDate As String, intNumberOfDays) As Integer
  Dim i As Integer
  For i = 0 To intNumberOfDays
    Select Case Weekday(DateAdd("d", i, CDate(strStartDate)))
      Case vbSaturday, vbSunday
        intNumberOfDays = intNumberOfDays - 1
    End Select
  Next i
  RemoveWeekends = intNumberOfDays
End Function