DAYSINAMONTH

DAYSINAMONTH(iMonthNumber, iYear)
Returns the number of days in a particular month and year.

iMonthNumber
iYear

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
Public Function DAYSINAMONTH( _

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

For instructions on how to add this function to a workbook refer to the page under Inserting Functions


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