
|
| |  |  | End Of Month |
|
|
| |  |  | First Of Last Month |
|
|
| |  |  | Make Directory |
|
|
Working Days This Month
Home :: Visual Basic :: Working Days This Month
Here's a simple Visual Basic function you can use in Vb6+/MS Access to calculate the number of working days this month
Public
Function BizDay()
As Integer 'returns the number of working days this month (to
date) Dim Msg As String Dim D2 As Variant Dim Count As Integer Dim Sunday As Integer On Local Error GoTo
BizDay_Err
Sunday =
0 Count = 1 D2 = DateSerial(Year(Date),
Month(Date), Count) Do While D2 < Date If WeekDay(D2) = 1
Then Sunday =
Sunday + 1 End If Count
= Count + 1 D2 = DateSerial(Year(Date), Month(Date),
Count) Loop
BizDay =
Count - Sunday -
1
BizDay_End: Exit Function
BizDay_Err:
Msg = "Error #: " & Format$(Err.Number) & vbCrLf Msg
= Msg & Err.Description MsgBox Msg, vbInformation,
"BizDay" Resume
BizDay_End
End Function |
Please Link to us
Next >> Delete Directory
|