Salut l'équipe,
heureusement que Theze a les yeux en face des trous : j'avais zappé les cellules avec deux dates!!
Code corrigé :
Public Function fctDate(ByVal iRow%, iCol%) As Date
'
Dim tData, tSplit
Dim dDate As Date
'
Application.Volatile
dDate = "1/1/2500"
tData = Range("B" & iRow).Resize(1, iCol - 2).Value
For x = 1 To UBound(tData, 2)
If tData(1, x) <> "" Then
For y = 0 To IIf(InStr(tData(1, x), Chr(10)) = 0, 0, 1)
tSplit = Split(Split(tData(1, x), Chr(10))(y))
For Z = 0 To UBound(tSplit)
If IsDate(tSplit(Z)) Then dDate = IIf(CDate(tSplit(Z)) < dDate, CDate(tSplit(Z)), dDate)
Next
Next
End If
Next
fctDate = dDate
'
End Function
ou...
Public Function fctDate(ByVal iRow%, iCol%) As Date
'
Dim tSplit, rCel As Range, dDate As Date
'
Application.Volatile
For Each rCel In Range("B" & iRow).Resize(1, iCol - 2)
If rCel <> "" Then
For x = 0 To IIf(InStr(rCel, Chr(10)) = 0, 0, 1)
tSplit = Split(Split(rCel, Chr(10))(x))
For y = 0 To UBound(tSplit)
If IsDate(tSplit(y)) Then dDate = IIf(CDate(tSplit(y)) < IIf(dDate = 0, "1/1/2500", dDate), CDate(tSplit(y)), IIf(dDate = 0, "1/1/2500", dDate))
Next
Next
End If
Next
fctDate = dDate
'
End Function
A+