Hello,
I try to use a simple CountIfs formula with a macro which runs w/h error, however the result is not shown(File "Prod" attached)
The code I use:
Sub Completion()
Dim ws1 As Worksheet: Set ws1 = Workbooks("Prod").Worksheets("1")
Dim ws2 As Worksheet: Set ws2 = Workbooks("Prod").Worksheets("2")
Dim lRow As Long, i As Long, c As Long
lRow = ws1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 11 To lRow
If ws1.Cells(i, 1).Value = "PPS" And ws1.Cells(i, 6).Value = "Réalisé" Then
For c = 7 To 60
ws1.Cells(i, c) = _
WorksheetFunction.CountIfs( _
ws2.Range("G:G"), ws1.Cells(7, c), _
ws2.Range("H:H"), ws1.Cells(6, c), _
ws2.Range("A:A"), ws1.Cells(i, 2), _
ws2.Range("B:B"), ws1.Cells(i, 3), _
ws2.Range("C:C"), ws1.Cells(i, 5))
Next c
End If
Next i
MsgBox "Done"
End Sub