siebel2002
Programmer
I would appreciate any help in snippet of code to determine the date for last Friday. Thank you..
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Today Weekday
Monday 1
Tuesday 2
Wednesday 3
Thursday 4
Friday 5
Saturday 6
Sunday 7
Function LastNDay(pDay As Date, wday As Integer) As Date
'*******************************************
'Name: LastNDay (Function)
'Purpose: Find date of day of week (Sun, Mon, etc)
' preceding a specified date
'Inputs: (1) ? LastNDay(date(), 3) 'Tuesday
' (2) ? LastNDay(#28-May-03#, 6) 'Saturday
'Output: (1) 5/27/03 'Today's date = 5/29/03
' (2) 5/23/03
'*******************************************
LastNDay = [pDay] - (WeekDay([pDay]) + IIf(WeekDay([pDay]) <= wday, 7, 0) - wday)
End Function