Sash
If you would like the solution in the form of a single formula, it is as
follows -
Function NoofDaysInMonth(ByVal dteFirstOfMonth As Date, ByVal intDayOfWeek
As Integer) As Integer
'
' dteFirstOfMonth = date of the first day of the month
' intDayOfweek is the vbConstant for the day of the week (Sunday = 1)
'
NoofDaysInMonth = Abs(Abs(Weekday(dteFirstOfMonth) - ((18 - (Day(DateAdd
("d", -1, DateAdd("m", 1, dteFirstOfMonth))) / 2)) + intDayOfWeek)) >= (18 -
(Day(DateAdd("d", -1, DateAdd("m", 1, dteFirstOfMonth))) / 2))) + Abs(Abs
(Weekday(dteFirstOfMonth) - ((18 - (Day(DateAdd("d", -1, DateAdd("m", 1,
dteFirstOfMonth))) / 2)) + intDayOfWeek)) <= ((Day(DateAdd("d", -1, DateAdd
("m", 1, dteFirstOfMonth))) / 2) - 11)) + 3
End Function