Bonjour,
Une proposition à adapter.
Il y a une procédure VBA pour transformer tes données initiales en tableau structuré pour l'utilisation correcte du TCD.
A te relire.
Cdlt.
Public Sub Main()
Dim wsData As Worksheet, wsTable As Worksheet, wsPT As Worksheet
Dim lastCol As Long, lastRow As Long
Dim lo As ListObject, tbl As Variant, arr() As Variant
Dim I As Long, J As Long, k As Long
Set wsData = ActiveWorkbook.Worksheets("Liste")
Set lo = Range("Données").ListObject
Set wsPT = Worksheets("TCD")
With wsData
lastCol = .Cells(3, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
tbl = .Cells(3, 1).Resize(lastRow - 2, lastCol)
End With
For I = 2 To UBound(tbl)
For J = 2 To UBound(tbl, 2)
If tbl(I, J) <> "" Then
ReDim Preserve arr(3, k + 1)
arr(0, k) = tbl(I, 1)
arr(1, k) = tbl(1, J)
arr(2, k) = tbl(I, J)
k = k + 1
End If
Next J
Next I
With lo
If Not .DataBodyRange Is Nothing Then .DataBodyRange.Delete
.InsertRowRange.Cells(1).Resize(k, 3).Value = Application.Transpose(arr)
End With
wsPT.PivotTables(1).PivotCache.Refresh
End Sub