Function CountDatesByMonth(ByRef Rng As Range, Optional ByVal M As Integer) As Long
Dim Cell As Range
Dim Cnt As Long
If M = 0 Then
M = Month(Now())
End If
For Each Cell In Rng
If IsDate(Cell) Then
If Month(Cell) = M Then Cnt = Cnt + 1
End If
Next Cell
CountDatesByMonth = Cnt
End Function
Hello Domenic,
If you go that way wouldn't this be simpler?
=SUMPRODUCT(--(A2:A100-DAY(A2:A100)=B2-DAY(B2)))