M
Manuel
I am trying to find out what the 3rd business day of the
month would be. I currently have a Work_Days function
which determines the amount of workdays in a month
excluding weekends and holidays. Any Ideas on how to
determine the third business day (i.e. for April 3rd
business day is 04/05/04). Attached is my Work_Days
funcion code:
Function Work_Days(BegDate As Date, EndDate As Date) As
Integer
Dim Days As Variant
Dim DateCnt As Variant
Dim EndDays As Integer
BegDate = DateValue(BegDate)
EndDate = DateValue(EndDate)
Days = DateDiff("d", BegDate, EndDate)
DateCnt = BegDate + 1
EndDays = 0
Do While DateCnt <= EndDate
Select Case DateValue(DateCnt)
Case DateValue(#1/1/2004#)
EndDays = EndDays + 1
Case DateValue(#5/31/2004#)
EndDays = EndDays + 1
Case DateValue(#7/5/2004#)
EndDays = EndDays + 1
Case DateValue(#9/6/2004#)
EndDays = EndDays + 1
Case DateValue
(#11/25/2004#)
EndDays = EndDays + 1
Case DateValue
(#11/26/2004#)
EndDays = EndDays + 1
Case DateValue
(#12/24/2004#)
EndDays = EndDays + 1
Case DateValue
(#12/31/2004#)
EndDays = EndDays + 1
Case Else
If Format
(DateCnt, "ddd") = "Sun" Or _
Format
(DateCnt, "ddd") = "Sat" Then
EndDays = EndDays
+ 1
End If
End Select
DateCnt = DateAdd("d", 1, DateCnt)
Loop
Work_Days = Days - EndDays
End Function
month would be. I currently have a Work_Days function
which determines the amount of workdays in a month
excluding weekends and holidays. Any Ideas on how to
determine the third business day (i.e. for April 3rd
business day is 04/05/04). Attached is my Work_Days
funcion code:
Function Work_Days(BegDate As Date, EndDate As Date) As
Integer
Dim Days As Variant
Dim DateCnt As Variant
Dim EndDays As Integer
BegDate = DateValue(BegDate)
EndDate = DateValue(EndDate)
Days = DateDiff("d", BegDate, EndDate)
DateCnt = BegDate + 1
EndDays = 0
Do While DateCnt <= EndDate
Select Case DateValue(DateCnt)
Case DateValue(#1/1/2004#)
EndDays = EndDays + 1
Case DateValue(#5/31/2004#)
EndDays = EndDays + 1
Case DateValue(#7/5/2004#)
EndDays = EndDays + 1
Case DateValue(#9/6/2004#)
EndDays = EndDays + 1
Case DateValue
(#11/25/2004#)
EndDays = EndDays + 1
Case DateValue
(#11/26/2004#)
EndDays = EndDays + 1
Case DateValue
(#12/24/2004#)
EndDays = EndDays + 1
Case DateValue
(#12/31/2004#)
EndDays = EndDays + 1
Case Else
If Format
(DateCnt, "ddd") = "Sun" Or _
Format
(DateCnt, "ddd") = "Sat" Then
EndDays = EndDays
+ 1
End If
End Select
DateCnt = DateAdd("d", 1, DateCnt)
Loop
Work_Days = Days - EndDays
End Function