![]() |
"Unable to get Pivot Tables Property of Worksheet Class "Error
I am trying to run a PIvot table macro and when I run it, I get Error
1004. However, whenever I run the same macro step by step(using F8), it works fine . Here is the macro code.. ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "'WOH details'!A:S").CreatePivotTable TableDestination:= _ "WOH!R3C1", TableName:="WOHPivot", DefaultVersion:= _ xlPivotTableVersion10 ActiveSheet.PivotTables("WOHPivot").AddFields RowFields:="Owner Name", _ ColumnFields:="Case Calendar Age Bucket-Hrs", PageFields:=Array( _ "Owner Work Group", "Case Priority") ActiveSheet.PivotTables("WOHPivot").PivotFields("C ase Id").Orientation = _ xlDataField ActiveWorkbook.ShowPivotTableFieldList = True Any help in this regards is greatly appreciated |
"Unable to get Pivot Tables Property of Worksheet Class "Error
Hi
Everything works fine when I try it. What is the exact errormessage you get. Usualy with this type of errors it is because your code depends on the active sheet being 'WOH' and perhaps it isn't when you run the macro... Perhaps if you change it to With ActiveWorkbook.PivotCaches.Add(xlDatabase, "'WOH details'! A:S").CreatePivotTable("WOH!R3C1", "WOHPivot", , xlPivotTableVersion10) .AddFields RowFields:="Owner Name", ColumnFields:="Case Calendar Age Bucket-Hrs", PageFields:=Array("Owner Work Group", "Case Priority") .PivotFields("Case Id").Orientation = xlDataField End With ActiveWorkbook.ShowPivotTableFieldList = True then it does't matter wich sheet is active. DQ |
"Unable to get Pivot Tables Property of Worksheet Class "Error
Thank you very much !!
I made the changes and on initial testing it seems to work... If I have any further problems, I will respond back. Really appreciate the excellent rapid response, :-) |
All times are GMT +1. The time now is 03:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com