Wednesday, July 29, 2009

loop through dates, skip days

Had an issue where I needed to loop from a start date to an end date but for certain weekdays, (like fridays or mondays, information coming from a series of checkboxes; 1 for each weekday) I needed to skip whichever the user checked off....

Solution:

For dt = StartDate To EndDate
If InStr( shiftdays, CStr(Weekday(dt)) ) > 0 Then
... process this dt ...
End If
Next

No comments:

Post a Comment