If anyone feels they can produce better code for this function go ahead and PM me your effort. If I feel that it is better (More efficient & 100% accurate) then I will replace this with it.
Until then, it is at least a usable version that visitors can use when they're in need.
Expand|Select|Wrap|Line Numbers
- 'MoveWD moves datThis on by the intInc weekdays.
- Public Function MoveWD(datThis As Date, intInc As Integer) As Date
- MoveWD = datThis
- For intInc = intInc To Sgn(intInc) Step -Sgn(intInc)
- MoveWD = MoveWD + Sgn(intInc)
- Do While (Weekday(MoveWD) Mod 7) < 2
- MoveWD = MoveWD + Sgn(intInc)
- Loop
- Next intInc
- End Function