Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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, :-) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Unable to get the VLookup property of the WorksheetFunction class | Excel Discussion (Misc queries) | |||
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" | Excel Programming | |||
Interop - "Unable to set the Color property of the Interior class" | Excel Programming | |||
"Unable to set the Formula property of the Series class" with a tw | Charts and Charting in Excel | |||
"Unable to get the Pivotfieldsd property of the Pivot Class" | Excel Programming |