Sub Recherche_cost()
Dim PartQty, BoxQty As Integer
Dim Service As String
Dim Rust As Boolean
Dim Rework As Boolean
Dim i As Integer
Dim R As Integer
Dim WSlist As Worksheet
Dim WScalc As Worksheet
Dim Labour As Long
Set WSlist = Workbooks("Simu last yeart macro.xlsm").Sheets("Summary")
Set WScalc = Workbooks("CostSA.xlsm").Sheets("Control")
For i = 2 To 10
WSlist.Activate
PartQty = WSlist.Cells(i, 7).Value
BoxQty = WSlist.Cells(i, 2).Value
Service = WSlist.Cells(i, 9).Value
Labour = WSlist.Cells(i, 11).Value
If WSlist.Cells(i, 22).Value = "Yes" Then
Rust = True
Else
Rust = False
End If
If WSlist.Cells(i, 23).Value = "Yes" Then
Rework = True
Else
Rework = False
End If
WScalc.Activate
WScalc.Cells(3, 3) = PartQty
WScalc.Cells(4, 3) = BoxQty
WScalc.Cells(7, 2) = Service
WScalc.Cells(11, 3) = PartQty
WScalc.Cells(13, 3) = Labour
WScalc.Cells(14, 3) = "Light"
If Rust = True Then Cells(15, 3) = "Yes" Else Cells(15, 3) = "No"
Cells(16, 3) = "No"
If Rework = True Then Cells(17, 3) = "Yes" Else Cells(17, 3) = "No"
WSlist.Activate
WSlist.Cells(i, 23).Value = WScalc.Cells(21, 13)
Next
End Sub