SOURCE DATA / ERROR - PIVOT TABLE CREATION

S

Sid

My objective is not define an absolute range for the pivot table, so when I
add data later on my pivot tabel will capture it without having to modify my
source data address.

I keep getting Run time error '1004' - Apllication defined or Object defined
error in the following code:

Sub creatpivot_table()
Dim PTCache As PivotCache
Dim PT As PivotTable

Set PTCache = ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlDatabase, _
SourceData:=Range("A1").CurrentRegion.Address)


Set PT = PTCache.CreatePivotTable(TableDestination:="",
TableName:="PivotTable4")

With PT
..PivotFields("CARDMEMBER_NAME").Orientation = xlRowField
..PivotFields("BILLING_AMOUNT").Orientation = xlDataField
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top