Bonjour,
Une autre solution.
Cdlt.
Public Sub ConsolidateData()
Dim ws As Worksheet, ws2 As Worksheet, n As Long, sFormula As String
Set ws = Worksheets("1"): Set ws2 = Worksheets("2")
n = ws.Cells(Rows.Count, 1).End(xlUp).Row
sFormula = "('1'!$A$1:$A$" & n & "=A1)*('1'!$C$1:$C$" & n & ")"
With ws2
With .Cells(1)
.CurrentRegion.ClearContents
.Resize(n) = ws.Cells(1).Resize(n).Value
End With
With .Cells(2).Resize(n)
.Formula = "=SUMPRODUCT(" & sFormula & ")"
.Value = .Value
End With
End With
End Sub