Date Function

  • Thread starter Thread starter Cipriano Loera
  • Start date Start date
C

Cipriano Loera

Please help: I need a date function that adds 10 business
days to it, Here is the pseudocode: date + 10 business days
 
Do a search. Business day math is discussed in these news groups allllll
the time.

Look for your answer first.
 
Good morning

Here is the function for word days.

Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.

-------------------------------------------
Option Explicit

Function Work_Days (BegDate As Variant, EndDate As Variant) As Integer
' Note that this function does not account for holidays.
Dim WholeWeeks As Variant
Dim DateCnt As Variant
Dim EndDays As Integer

BegDate = DateValue(BegDate)

EndDate = DateValue(EndDate)
WholeWeeks = DateDiff("w", BegDate, EndDate)
DateCnt = DateAdd("ww", WholeWeeks, BegDate)
EndDays = 0
Do While DateCnt < EndDate
If Format(DateCnt, "ddd") <> "Sun" And _
Format(DateCnt, "ddd") <> "Sat" Then
EndDays = EndDays + 1
End If
DateCnt = DateAdd("d", 1, DateCnt)
Loop
Work_Days = WholeWeeks * 5 + EndDays
End Function
 
Back
Top