Bonjour,
Je copie le tableau à partir de la cellule J1
Le code :
Sub transpos()
Dim Cel As Range
Dim I As Byte
Dim Derlig As Long, NbLig As Long, NbCol As Long
Dim Uniq As Object
Columns("J:IV").Clear
Derlig = Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(2, 1), Cells(Derlig, 1)).Name = "Plg1"
Range(Cells(2, 2), Cells(Derlig, 2)).Name = "Plg2"
Range(Cells(2, 3), Cells(Derlig, 3)).Name = "Plg3"
Set Uniq = CreateObject("Scripting.Dictionary")
For I = 1 To 2
For Each Cel In Range(Cells(2, I), Cells(Derlig, I))
Uniq(Cel.Value) = Cel.Value
Next Cel
If I = 2 Then Range("K1").Resize(, Uniq.Count) = Uniq.items: NbCol = Uniq.Count
If I = 1 Then Range("J2").Resize(Uniq.Count) = Application.Transpose(Uniq.items): NbLig = Uniq.Count: Uniq.RemoveAll
Next I
With Range("K2").Resize(NbLig, NbCol)
.FormulaR1C1 = "=SUMPRODUCT((Plg1=RC10)*(Plg2=R1C)*Plg3)"
.Value = .Value
End With
Range("J1").Resize(NbLig + 1, NbCol + 1).HorizontalAlignment = xlCenter
End Sub
Regarde le fichier joint :
Bon courage