Sub Main()
Debug.Print DeliveryDateMaint(1998,12)
End Sub
Public Function DeliveryDateMaint(intYear As Integer, intMonth As Integer)
Dim datStart As Date
datStart = DateSerial(intYear, intMonth, 8)
Select Case Weekday(datStart, vbSunday)
Case vbSunday
DeliveryDateMaint = datStart + 3
Case vbMonday
DeliveryDateMaint = datStart + 2
Case vbTuesday
DeliveryDateMaint = datStart + 1
Case vbWednesday
DeliveryDateMaint = datStart
Case vbThursday
DeliveryDateMaint = datStart + 6
Case vbFriday
DeliveryDateMaint = datStart + 5
Case vbSaturday
DeliveryDateMaint = datStart + 4
End Select
End Function
|