Hi, I have been trying to get this right all day....HELP. What I need to is select a date and then find the date of the previous Sunday. Could someone put me on the right path on how to do this....Thanks.
Dim lastsunday As String
Dim somedate As Long
Dim dayssincesunday As Int
somedate = DateTime.Now
dayssincesunday = DateTime.GetDayOfWeek(somedate) 'returns an int 1 is sunday 2 monday etc
lastsunday = DateTime.Date(DateTime.Add(somedate,0,0, (dayssincesunday - 1) * -1)) 'we subtract 1 as sunday is 1 based not zero based
this returns the date as a string, leave out 'DateTime.Date' and you will have a long