1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Sub test()
For i = 6 To 160
For j = 3 To 30
If Cells(5, j) = "" Then
Exit For
End If
If Range("B" & i) <> "" Then
With Worksheets("Poste de travail")
If SumProduct((.[E1:E65000] = Range("B" & i)) * (.[J1:J65000] = Range("E" & i)), (.[H1:H65000])) <> 0 Then
Cells(i, j) = SumProduct((.[E1:E65000] = Range("B" & i)) * (.[J1:J65000] = [E1]), (.[H1:H65000]))
End If
End With
End If
'sinon au lieu du copier/coller tu peux affecter la valeur (pas testé mais je pense plus rapuide)
' Cells(i, j) = "=IF(RC2="""","""",IF(SUMPRODUCT(('Poste de travail'!R1C5:R65000C5=RC2)*('Poste de travail'!R1C10:R65000C10=R5C),('Poste de travail'!R1C8:R65000C8))=0,"""",SUMPRODUCT(('Poste de travail'!R1C5:R65000C5=RC2)*('Poste de travail'!R1C10:R65000C10=R5C),('Poste de travail'!R1C8:R65000C8))))"
' Cells(i, j).Value = Cells(i, j).Value
Next
If Cells(i + 1, 2) = "" Then
End If
Next
End Sub |
Partager