Const sep$ = vbLf 'séparateur mémorisé, modifiable
Function Recherche_dates(critere$, colonnes As Range) As String
Dim d As Object, nlig&, tablo, i&, j%, dat, x$
Set d = CreateObject("Scripting.Dictionary") 'pour éliminer les doublons
d.CompareMode = vbTextCompare 'la casse est ignorée
Set colonnes = Intersect(colonnes, colonnes.Parent.UsedRange.EntireRow)
tablo = colonnes 'matrice, plus rapide
nlig = UBound(tablo)
For j = 2 To UBound(tablo, 2)
For i = 2 To nlig
If tablo(i, j) = critere Then
dat = colonnes(1, j).MergeArea(1)
If dat >= Date Then
x = Format(dat, "dd/mm/yyyy") & IIf(colonnes(i, j).Interior.Color = vbWhite, " JOUR", " NUIT")
If Not d.exists(x) Then d(x) = "": Recherche_dates = Recherche_dates & sep & x
End If
End If
Next i, j
Recherche_dates = Mid(Recherche_dates, Len(sep) + 1)
End Function
Function Derniere_date(x$) As Date
Dim s
If x = "" Then Exit Function
s = Split(x, sep)
Derniere_date = Split(s(UBound(s)))(0)
End Function