Pivot table error
I have the following codes. It works fine the first time I run it. The next
time I run it there is a error message "Method create pivot table of object pivotcache failed". It will only work fine if I exit Excel and run the codes again. Anyone knows why there is a error. The code stops at the "Set PT" row. FYI, I set PTCache and PT to nothing before I exit the codes. Set PTCache = Workbooks("Template.xls").PivotCaches.Add(SourceTy pe:=xlDatabase, _ SourceData:=Range("A1").CurrentRegion.Address) Set PT = PTCache.CreatePivotTable(TableDestination:="", TableName:="PivotTable1") |
Pivot table error
Found the cause. Empty headers.
-- help needed "linglc" wrote: I have the following codes. It works fine the first time I run it. The next time I run it there is a error message "Method create pivot table of object pivotcache failed". It will only work fine if I exit Excel and run the codes again. Anyone knows why there is a error. The code stops at the "Set PT" row. FYI, I set PTCache and PT to nothing before I exit the codes. Set PTCache = Workbooks("Template.xls").PivotCaches.Add(SourceTy pe:=xlDatabase, _ SourceData:=Range("A1").CurrentRegion.Address) Set PT = PTCache.CreatePivotTable(TableDestination:="", TableName:="PivotTable1") |
All times are GMT +1. The time now is 10:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com