Dim [COLOR=red]ListeComp([/COLOR])
ReDim ListeComp(1 To 2, 0)
With ThisWorkbook.Worksheets("Nomenclature")
DerLigne = .Range("A65536").End(xlUp).Row
For i = 2 To DerLigne
If .Cells(i, 4).Value = NomApp Then
ReDim Preserve ListeComp(1 to 2,UBound(ListeComp) + 1)
ListeComp(1,UBound(ListeComp)) = .Cells(i, 10).Value
ListeComp(2,UBound(ListeComp)) = .Cells(i, 13).Value
End If
Next i
End With
Set Wkb = Workbooks.Open(ThisWorkbook.Path & "\COUT STANDARD.xls")
DerLigne = Wkb.ActiveSheet.Range("A65536").End(xlUp).Row
For i = 1 To UBound(ListeComp, 2)
Code = Left([COLOR=red]ListeComp(1, i)[/COLOR], InStr(1, [COLOR=red]ListeComp(1, i),[/COLOR] " ") - 1)
If Application.WorksheetFunction.CountIf(Wkb.ActiveSheet.Range("A4:A" & DerLigne), Code) = 0 Then
Remarque = "Certains composants sont introuvables dans Liste prix composant.xls"
Else
Total_Purch = Total_Purch + CDbl(ListeComp(2, i)) * CDbl(Application.WorksheetFunction.VLookup(Code, Wkb.ActiveSheet.Range("A4:B" & DerLigne), 2, False))
Total_Sourcing = Total_Sourcing + CDbl(ListeComp(2, i)) * CDbl(Application.WorksheetFunction.VLookup(Code, Wkb.ActiveSheet.Range("A4:C" & DerLigne), 3, False))
End If
Next i