Count # of Days in a Month
DFruge,
This will work for you:
Regards,
David Miller
Function HowManyMondaysInMay2007()
Debug.Print GetDaysInMonth("Monday", "05/01/07")
End Function
Function GetDaysInMonth(sDay As String, dtm As Date) As Long
Dim DaysInMonth As Long, _
i As Integer
DaysInMonth = Day(DateSerial(Year(dtm), Month(dtm) + 1, 0))
For i = 1 To DaysInMonth
If WeekdayName(Weekday(dtm + i)) = sDay Then
GetDaysInMonth = GetDaysInMonth + 1
End If
Next
End Function
|