Saturday, April 10, 2010

Getting the Last Sunday of the Week

To get the Sunday of the week that just passed, use the following in
VBA: 



    Public Function GetSunday(keyDate As Date) As Date
       GetSunday = DateSerial(Year(keyDate) _
           , Month(keyDate) _
           , Day(keyDate) - DatePart("w", keyDate) + 1)
   End Function 


No comments:

Post a Comment