PDA

View Full Version : Add Table to Data Model (Pivot Table)



jazz2409
04-27-2020, 10:48 PM
Hi, I am creating a Pivot Table but I want to add the source to a data model. How do I change this?


Set PC = ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Sheet2.Range("A1").CurrentRegion)
Set pt = PC.CreatePivotTable(TableDestination:=Sheet1.Range("A1"))?