Function to return previous Friday's date based on current date.
Function to return previous Friday's date based on current date.
API Declarations
'This code could be adjusted to return any previous day of the week. It
'returns the current date if function is called on a Friday but could be
'adjusted to return the previous Friday's date.
Rate Function to return previous Friday's date based on current date.
(1(1 Vote))
'Declare variables
Dim intStartDay As Integer
'Calculate previous Friday as status date if today is not Friday.
intStartDay = WeekDay(dteStatus)
Select Case intStartDay
Case 1
LastFriday = Date - 2
Case 2
LastFriday = Date - 3
Case 3
LastFriday = Date - 4
Case 4
LastFriday = Date - 5
Case 5
LastFriday = Date - 6
Case 6
'Add " - 7" to next line for previous Friday.
LastFriday = Date
Case 7
LastFriday = Date - 1
End Select
End Function
Function to return previous Friday's date based on current date. Comments
No comments yet — be the first to post one!
Post a Comment