Retrieving the first sunday date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dim firstSunday As Date
firstSunday = FormatDateTime(#1/1/2006#)

i want to retrive the first sunday of the current year and put that in the
expression in the code up top, instead of writing in the exact expression
for this year (like how i did).
 
Dim firstSunday As Date

firstSunday = DateSerial(Year(Date) ,1 ,1)
firstSunday = DateAdd("d",vbSunday - DatePart("w",firstSunday),
firstSunday)
if Year(firstSunday) < Year(Date) Then
firstSunday = DateAdd("ww", 1, firstSunday)
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top