DAYSINAMONTH

DAYSINAMONTH(month_number, year)
Returns the number of days in a month and year.

month_numberThe month number or string.
yearThe year

REMARKS
* 31 days - Jan, Mar, May, Jul, Aug, Oct, Dec
* 30 days - Apr, Jun, Sep, Nov
* 28/29 days - Feb
* The equivalent Excel formula is Number of days in a particular month

 A
1??

Public Function DAYSINAMONTH( _ 
         ByVal iMonthNumber As Integer, _
         ByVal iYear As Integer) _
         As Integer

   DAYSINAMONTH = VBA.Day(VBA.DateSerial(iYear, iMonthNumber + 1, 1) - 1)
End Function

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext