Function Dates Times Class

EndOfAddMonths

Return the last day of the month after adding a number of months to the given date.

Signature (Visual Basic / VBA)

Public Function EndOfAddMonths( _
      ByVal vDate As Variant _
    , ByVal vMonths As Variant _
    ) As Variant

Code Example

    EndOfAddMonths(#1/15/99#,  1) = #2/28/99#
    EndOfAddMonths(#1/15/99#,  2) = #3/31/99#
    EndOfAddMonths(#1/15/99#,  5) = #6/30/99#
    EndOfAddMonths(#1/15/99#, -2) = #11/30/98#

Parameters

Parameter Description
vDate The date to which a number of months are added according to vMonths. Function returns Null if vDate is Null or cannot be interpreted as a Date.
vMonths The number of months to add to the date vDate. vMonths is truncated to a long integer number. Function returns Null if vMonths is Null or cannot be interpreted as a Long Integer number.

Notes & Version History

Note This function returns the exact same results as the EOMONTH function in Microsoft Excel.
v2.0 Addition This function is new to this version of Entisoft Tools.