James has attended:
Access VBA course
Working days formula
calculating working days diff rather than daysdiff.
steve asked to post reminder
RE: working days formula
Hi James
Thanks for the post, Stephen is available tomorrow and will review your post.
regards
Jacob
RE: working days formula
Still no reply to my question
Unless I am missing it?
RE: working days formula
Hi James
Apologies, I was sure I had answered this but I can find no reference to it, so I can only imagine that there was some glitch when I tried to post.
The following function will count the working days between two dates, by excluding Saturdays and Sundays.
Function WorkDays(dteStart As Date, dteFinish As Date) As Integer
Dim dteDateCount As Date
Dim intCount As Integer
For dteDateCount = dteStart To dteFinish
If Weekday(dteDateCount) <> 7 Then 'excludes saturdays
If Weekday(dteDateCount) <> 1 Then 'excludes sundays
intCount = intCount + 1
End If
End If
Next dteDateCount
WorkDays = intCount
End Function
It uses the vb function weekdays to exclude dates on a saturday (day7) or a sunday(day1).
The following procedure calls this function and places two dates for the start and finish arguments
Sub Caller()
MsgBox WorkDays(#10/19/2009#, #10/28/2009#)
End sub
Hope this helps
Regards
Stephen