'Renvoie la valeur de CostElement
'en fonction :
' - du "OTP de destination" (colonne L)
' - de la plage contenants les codes OTP (onglet "MO Qte", A118:A)
'Private Function CostElement(psOTPDestination As String, poPlageCodeOTP As Range) As String
Private Function CostElement(psOTPDestination As String, poShMoQte As Worksheet) As String
Dim oRes As Range
Dim iDerLig As Integer, iPreLig As Integer
Dim oPlageCodeOTP As Range
'Set oRes = poPlageCodeOTP.Find(psOTPDestination, LookAt:=xlWhole)
iDerLig = poShMoQte.Range("A" & Rows.Count).End(xlUp).Row
iPreLig = Application.Match("MOI", poShMoQte.Columns(2), 0) + 1
With poShMoQte
Set oPlageCodeOTP = .Range(.Cells(iPreLig, "A"), .Cells(iDerLig, "A"))
End With
Set oRes = oPlageCodeOTP.Find(psOTPDestination, LookAt:=xlWhole)
If oRes Is Nothing Then
CostElement = 2015
Else
CostElement = 2016
End If
Set oRes = Nothing
End Function