Try this. As default it counts the number of Mondays in a
specified month, but gives the option of specifying any
weekday to count.
CODE
Function CountWeekdays(pMoYr As String, _
Optional pDay As Integer = vbMonday) As Integer
'*********************************************
'Purpose: Count number of specified weekdays
' (e.g. Monday) in the target month
'Coded by: raskew
'Note: When calling the function, use 4-digit year
'Inputs: 1) ? CountWeekdays("9/2004")
' 2) ? CountWeekdays("9/2004", 4)
'
'Output: 1) 4
' 2) 5
're: http://www.utteraccess.com/forums/showflat. _
php?Cat=&Board=87&Number=538495&page=0&view= _
collapsed&sb=5&o=&fpart=1
'*********************************************
Dim dteFirst As Date
Dim dteLast As Date
Dim dteStart As Date
'convert pMoYr (e.g. 9/2004) to a date representing the first day of the month
dteFirst = DateValue(pMoYr)
'find how many days in the month
dteLast = DateAdd("m", 1, dteFirst) - 1
'find the first pDay of the month
dteStart = dteFirst - WeekDay(dteFirst) + pDay + IIf(WeekDay(dteFirst) > pDay, 7, 0)
'calculate # of occurences from dteStart to the last day of month
CountWeekdays = 1 + Int((Day(dteLast) - Day(dteStart)) / 7)
End Function
HTH - Bob