jaaret
Instructor
- Jun 19, 2002
- 171
I am attempting to create a function that will return the first workday of the week (Monday). The function I created is as follows:
Public Function Monday(DateDue As Date) As Date
Dim WDay As Integer
WDay = Weekday(DateDue)
Select Case WDay
Case WDay = 1
Monday = DateDue + 1
Case WDay = 2
Monday = DateDue
Case WDay = 3
Monday = DateDue - 1
Case WDay = 4
Monday = DateDue - 2
Etc...
The function is returning a date that is consistently 700 days prior to the DateDue. Example: if the DateDue is 07-Jan-2013 the function is returning 07-Feb-2011. Why am I getting this result?