Function tata%(d As Date, sh$)
Dim i&, j&, oDat(), oDeb(), oFin(), v%(86399), MAX%
With Sheets(sh)
i = .Cells(.Rows.Count, 1).End(xlUp).Row
If i > 1 Then
oDat = .Range(.Cells(1, 1), .Cells(i, 1)).Value
oDeb = .Range(.Cells(1, 2), .Cells(i, 2)).Value
oFin = .Range(.Cells(1, 4), .Cells(i, 4)).Value
For i = 2 To UBound(oDat, 1)
If oDat(i, 1) = d Then
For j = Round(86400 * oDeb(i, 1), 0) To Round(86400 * oFin(i, 1) - 1, 0)
v(j) = v(j) + 1
If MAX < v(j) Then MAX = v(j)
Next
End If
Next i
tata = MAX
End If
End With
End Function