View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Finding Number Of Days in a month

Hi Charles

This is how I'd do it:

Function DaysInMonth(Dt As Date) As Long
DaysInMonth = Day(DateSerial(Year(Dt), _
Month(Dt) + 1, 0))
End Function

Sub test()
Dim L As Long, Dt As Date
For L = 1 To 12
Dt = DateSerial(2004, L, 1)
MsgBox _
Format(Dt, "mmmm yyyy") & " has " & _
DaysInMonth(Dt) & " days"
Next
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Charles" wrote in message
...
Hi I need to find uot how many days are in a month in VBA
is there a way of doing this if so can someone help me
please TIA
Charles