Pivot Tables Collection

You can use another method to create a PivotTable from a PivotCache, using the Add method of the PivotTables collection. If you have already created a PivotCache in your workbook and you want to create a second PivotTable, you can use the following code:

Sub AddTable()

Dim pvc As PivotCache Dim pvt As PivotTable

'Access existing PivotCache

Set pvc = ActiveWorkbook.PivotCaches(l)

'Add new PivotTable to PivotTables collection

Set pvt = ActiveSheet.PivotTables.Add(PivotCache:=pvc, _

TableDestination:=Range("A3"))

End Sub

There is no particular advantage to using this method compared with the CreatePivotTable method. It's just another thread in the rich tapestry of Excel.

Ultimate Blackjack System

Ultimate Blackjack System

Discover the 100 Legal Secrets Las Vegas Professional Blackjack Gamblers Use to Make Literally Thousands of Dollars Every Week... I'll Teach You the Ultimate Step-by-Step Blackjack System, Casino's Don't Want You to Know About! That's Right, I'll show you step-by-step how to have the blackjack odds in your favor, guaranteed!

Get My Free Ebook


Post a comment