Use DateSerial and Weekday : DateSerial « Date Functions « VBA / Excel / Access / Word






Use DateSerial and Weekday

 

Public Function DeliveryDateFast(intYear As Integer, intMonth As Integer)
    Dim datStart        As Date
    datStart = DateSerial(intYear, intMonth, 8)
    DeliveryDateFast = datStart + (7 - Weekday(datStart, vbThursday))
End Function
Sub Main()
   Debug.Print DeliveryDateFast(1998,7)
End Sub 

 








Related examples in the same category

1.DateSerial(year, month, day) returns a Variant/Date containing the date for the specified year, month, and day
2.DateSerial(4, 11, 23) returns 11/23/2004
3.Delivery Date Maint