Looking ahead is part of most projects. Whether you’re scheduling downtime or a special event, knowing the date of the next Saturday can come in handy. In that case, the following VBA function procedure should help:
Public Function FindNextSaturday(dte As Date) As Date
'Return the first Saturday following dte
FindNextSaturday = dte + (7 - Weekday(dte))
End Function
Simply pass a date to the function — but be sure to delimit it properly using the # character as follows:
#09/30/09#
The dte + (7 – Weekday(dte)) component adds the number of days between the passed date and the next Saturday to the current date — the result being the next Saturday. This function should work in any application that supports VBA.