Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Minitman, I am not sure what Tom would do, but this is my approach. Find th first Sunday back from the 1st of next month. This assumes Sunday i the First day of the week. Add a VBA Module to your project and copy this code to it. This macr can be used as a Worksheet Formula or as a VBA Function call. Be sur to format the Cell or Variable as a Date. WORKSHEET FORMULA EXAMPLE =LastSunday() Code ------------------- Public Function LastSunday() As Date Dim D, X X = DateSerial(Year(Now), Month(Now)+1, 1) D = Weekday(X) - 1 LastSunday = X - D End Function ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48476 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date Format Question | Excel Discussion (Misc queries) | |||
Date Format question | Excel Discussion (Misc queries) | |||
Date format Question | Excel Discussion (Misc queries) | |||
Date Format Question | Excel Discussion (Misc queries) | |||
Date format question | Excel Programming |