Hello,
I have an error message and don't know how to continue.
By using File A data, I need to look up values in File B and to copy the results into the File A, if 2 conditions are matched: to have the same week and the same project
For this my intention is to run an index formula with two match criteria: first with search on the row(by the week: e.g. W1 W2 W3.....W52), second with search on the column (by the project name: e.g. eK9, CC21 etc).
I indend to check only those lines from File A which are fullfiling the following 3 conditions: ws1.Cells(i, 1).Value = "PPS" And ws1.Cells(i, 3).Value = "Projet" And ws1.Cells(i, 6).Value = "Prévisionnel"
Here is the code I started with. Many thanks for support.
Sub Prev()
Dim ws1 As Worksheet: Set ws1 = Workbooks("File A").Worksheets("Sheet1")
Dim ws2 As Worksheet: Set ws2 = Workbooks("File B").Worksheets("VP")
Dim lRow As Long, x As Long, lRow2 As Long, i As Long, c As Long
lRow = ws1.Cells(Rows.Count, 1).End(xlUp).Row
For c = 13 To 72
For i = 9 To lRow
If ws1.Cells(i, 1).Value = "PPS" And ws1.Cells(i, 3).Value = "Projet" And ws1.Cells(i, 6).Value = "Prévisionnel" Then
ws1.Cells(i, c) = _
Application.WorksheetFunction.Index(ws2.Range("D11:BG25"), _
Aplication.WorksheetFunction.Match(ws1.Cells(6, c), ws2.Range("H11:BG11"), 0) _
Application.WorksheetFunction.Match(ws1.Cells(i, 5), ws2.Range("F12:F25"), 0))
End If
Next
Next
End Sub