Bonsoir à tous,
Avec le fichier du post #1
Option Explicit
Sub Ventile()
Dim a, e, i As Long, j As Long, dico As Object
Set dico = CreateObject("Scripting.Dictionary")
'dico.CompareMode = 1
For Each e In Array("Sources1", "Sources 2")
a = Sheets(e).[a1].CurrentRegion.Value
For i = 2 To UBound(a, 1)
If Not dico.exists(a(i, 2)) Then
Set dico(a(i, 2)) = CreateObject("Scripting.Dictionary")
dico(a(i, 2)).CompareMode = 1
End If
Select Case e
Case "Sources1"
dico(a(i, 2))("Equip Nb") = dico(a(i, 2))("Equip Nb") + a(i, 7)
dico(a(i, 2))("REC NB") = dico(a(i, 2))("REC NB") + a(i, 8)
Case "Sources 2"
dico(a(i, 2))(a(i, 3) & " NB") = dico(a(i, 2))(a(i, 3) & " NB") + 1
dico(a(i, 2))(a(i, 3) & " Mnt") = dico(a(i, 2))(a(i, 3) & " Mnt") + a(i, 5)
End Select
Next
Next
Application.ScreenUpdating = False
With Sheets("Synthése").[b1].CurrentRegion
With .Offset(1, 1).Resize(.Rows.Count - 1, .Columns.Count - 1)
.ClearContents
End With
For i = 2 To .Rows.Count
If dico.exists(.Cells(i, 1).Value) Then
For j = 2 To .Columns.Count
If dico(.Cells(i, 1).Value).exists(.Cells(1, j).Value) Then
.Cells(i, j).Value = dico(.Cells(i, 1).Value)(.Cells(1, j).Value)
End If
Next
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Edit : je ne comprends rien à votre histoire de dates
klin89