Function DateMax(ByVal x)
Dim res As Date, d As Date, i&, s$
i = 1: res = DateSerial(1901, 1, 1)
x = Replace(Replace(x, vbLf, ""), " ", "")
Do
s = Mid(x, i, 10)
i = i + 1
If s Like "##/##/####" Then
i = i + 9
If IsDate(s) Then
d = CDate(s)
If s = Format(d, "dd/mm/yyyy") Then If d > res Then res = d
End If
End If
If i > Len(x) Then Exit Do
Loop
DateMax = IIf(res = DateSerial(1901, 1, 1), "", res)
End Function