C
Charlotte E.
Can anyone give me a VBA formalua, which will return the date of the second
Sunday in the month of May, given any year?
TIA,
CE
Sunday in the month of May, given any year?
TIA,
CE
Peter said:Afraid that worksheet formula is wrong if the 2nd Sunday is the 15th,
an easy fix. But I notice now you asked for VBA
Function May2ndSunday(yr) As Date
Dim dy As Long
yr = CLng(yr)
dy = 15 - Weekday(DateSerial(yr, 5, 0))
May2ndSunday = DateSerial(yr, 5, dy)
End Function
Regards,
Peter T
Peter said:Afraid that worksheet formula is wrong if the 2nd Sunday is the 15th,
an easy fix. But I notice now you asked for VBA
Function May2ndSunday(yr) As Date
Dim dy As Long
yr = CLng(yr)
dy = 15 - Weekday(DateSerial(yr, 5, 0))
May2ndSunday = DateSerial(yr, 5, dy)
End Function
Regards,
Peter T