Info

1 Define input area and set up a Pivot Cache FinalRow = WSD.Cells(65536, 1).End(xlUp).Row Set PRange = WSD.Cells(1, 1).Resize(FinalRow, 8)

Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, _ SourceData:=PRange.Address)

After the pivot cache is defined, use the CreatePivotTable method to create a blank pivot table based on the defined PivotCache:

Set PT = PTCache.CreatePivotTable(TableDestination:=WSD.Range("J2"), _ TableName:="PivotTable1")

In the CreatePivotTable method, you specify the output location and give the table a name. After running this line of code, you have a strange-looking blank pivot table that looks like Figure 12.6.

Figure 12.6

Immediately after using the CreatePivotTable method, Excel gives you a 4-cell blank pivot table that is not very useful.You now have to use code to drop fields on to the table.

Figure 12.6

Immediately after using the CreatePivotTable method, Excel gives you a 4-cell blank pivot table that is not very useful.You now have to use code to drop fields on to the table.

0 0

Post a comment