Public Function DiasDelMes (Byval Mes as Integer) As Integer
If Mes < 1 or mes > 12 Then
MsgBox "El mes no es válido." _
, vbExclamation, "Dias del mes"
Exit Function
End If
If Mes < 12 Then
DiasDelMes = DateDiff("d","1/" & Mes & "/" & Year(Now), "1/" & Mes + 1 & "/" & Year(Now))
Else
DiasDelMes = DateDiff("d","1/12/" & Year(Now), "1/1/" & Year(Now) + 1)
End If
End Function