LargeDate is a function within ddGlobal and forms part of the ddDate suite of macros. It is use to obtain the largest date in a series of YYYY-MM text formatted dates.
See the below example:
TheRange |
2013-03 |
2012-03 |
2005-01 |
2000-11 |
2001-01 |
2005-03 |
2010-08 |
2018-09 |
Entering the formula
=+LargeDate(A2:A9)
should produce the answer “2018-09″ using the above data.
The code for the function is below:
Function LargeDate(TheRange As Range) 'The function is used to get the largest "DATE" from a range i.e. '2001-06, 2001-09, 2002-01 the answer will be 2001-01 'Written by Denis Dell on 03/12/2001 Dim i, j As Integer Dim LargeNr As Double With TheRange For i = 1 To .Rows.Count For j = 1 To .Columns.Count If ConvertToDays(.Cells(i, j).Value) > LargeNr Then LargeNr = ConvertToDays(.Cells(i, j).Value) LargeDate = CleanDate(.Cells(i, j).Value) End If Next j Next i End With End Function
please note that you also need the formula “ConvertToDays”