1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Dim CACHE As PivotCache
Dim TCD1 As PivotTable
Dim TABLEAU As ListObject
Dim DERNIERE_FEUILLE As Worksheet
Set DERNIERE_FEUILLE = Worksheets(Worksheets.Count)
Set TABLEAU = DERNIERE_FEUILLE.ListObjects.Add(xlSrcRange, Range("A1").CurrentRegion, , xlYes)
TABLEAU.Name = "Stock 8mois" & DERNIERE_FEUILLE.Name
Set ETIQ_TOTAL = Range("S1").End(xlDown).Offset(6, 0)
Set CACHE = PivotCaches.Create(SourceType:=xlDatabase, SourceData:=TABLEAU)
Set TCD1 = CACHE.CreatePivotTable(ETIQ_TOTAL.Offset(2, 0))
with DERNIERE_FEUILLE
With TCD1
.PivotFields("Gamme khéops").Orientation = xlRowField
.AddDataField.PivotField ("Stock dans 8M hors entrée K"), "somme par gamme", xlSum
End With
end with |
Partager