Const sFeuil_DB As String = "DB_SOR"
Const nCol_SOR As Integer = 1
Const nCol_Dlv As Integer = 2
Const nCol_Combi As Integer = 3
Const nCol_Long As Integer = 4
Const nPremLig As Integer = 2
Function TrouveLongBrute(Section, Longueur, Dlv, SOR)
Dim oWs_DB As Excel.Worksheet
Set oWs_DB = ThisWorkbook.Worksheets(sFeuil_DB)
Combinaison = Left(Section, 8) & "/" & Longueur
nDerLig = oWs_DB.Range("A" & Rows.Count).End(xlUp).Row
If InStr(1, Combinaison, "+") Then
For nLig = nPremLig To nDerLig
DateDlv = DateSerial(Right(oWs_DB.Cells(nLig, nCol_Dlv), 2), Mid(oWs_DB.Cells(nLig, nCol_Dlv), 4, 2), Left(oWs_DB.Cells(nLig, nCol_Dlv), 2))
If oWs_DB.Cells(nLig, nCol_SOR) = SOR And oWs_DB.Cells(nLig, nCol_Combi) = Combinaison And DateDlv = Dlv Then
TrouveLongBrute = oWs_DB.Cells(nLig, nCol_Long)
Exit Function
End If
Next nLig
End If
TrouveLongBrute = Longueur
End Function