'********************************************************************************************************** ' Name: monthsDifference ' Author: mielk | 2012-06-15 ' ' Comment: Function to count the difference in months between two dates. ' ' Parameters: ' startDate Start date. ' endDate End date. ' ' Returns: ' Long The number of months between two given dates. ' If both dates were in the same month, 0 is returned. ' If the given end date is later than the start date, negative value is returned. ' ' ' --- Changes log ----------------------------------------------------------------------------------------- ' 2012-06-15 mielk Function created. '********************************************************************************************************** Public Function monthsDifference(startDate As Date, endDate As Date) As Long Const METHOD_NAME As String = "monthsDifference" '------------------------------------------------------------------------------------------------------ monthsDifference = VBA.DateDiff("m", startDate, endDate) End Function