Function FrstDay(D As Variant, ReqWeekday As Integer) As Date
' Returns the date of the first specified day in a month
' ReqWeekDay 1 - Sunday, 2 - Monday, 3 - Tuesday, etc.
FrstDay = NextDay(EndOfMonthPrev(D), ReqWeekday)
End Function
Function NextDay(D As Variant, DayCode As Integer) As Variant
'
' Returns the date of the next DayCode (1=Sun ... 7=Sat) after the
' date D.
NextDay = D - WeekDay(D) + DayCode + IIf(WeekDay(D) < DayCode, 0, 7)
End Function