LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Runtime Error '1004' - AddFields method of PivotTable class failed

Hi,

I can create a pivottable fine but when I record this to a macro and
try to run the macro I get an error on this line:

ActiveSheet.PivotTables("PivotTable3").AddFields
RowFields:=Array("STAGE", _
"SUB STAGE", "BUSINESS DESC", "Data"), ColumnFields:="EXPIRED"

Does anyone know what the solution to this is? (Note: I did a search
on this topic and found nothing)

Full macro code below:

Sub Create_PivotTable()
'
' Create_PivotTable Macro
' Macro recorded 21/05/2004 by MikeC
'

'
Sheets("TransferInData").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase,
SourceData:= _
"TransferInData!C1:C8").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable3", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard
TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable3").AddFields
RowFields:=Array("STAGE", _
"SUB STAGE", "BUSINESS DESC", "Data"), ColumnFields:="EXPIRED"
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("BUSINESS
DESC")
.Orientation = xlDataField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("PROCESSED")
.Orientation = xlDataField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable3").PivotFields ("BUSINESS
DESC"). _
Orientation = xlDataField
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveWorkbook.ShowPivotTableFieldList = False
ActiveWindow.SmallScroll Down:=12
End Sub

Regards,

MikeC
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime 1004 error -- insert method of range class failed. tish Excel Discussion (Misc queries) 1 June 1st 07 04:04 PM
RUNTIME ERROR '1004' --- Select method of worksheet class failed jawee Excel Programming 2 April 30th 04 06:47 AM
runtime error '1004' delete Method of Range Class Failed Tom Kennedy Excel Programming 0 April 14th 04 08:08 PM
runtime error '1004' delete Method of Range Class Failed Tom Ogilvy Excel Programming 0 April 1st 04 04:09 AM
excel97: runtime error 1004 select method of range class failed JMCN Excel Programming 4 December 25th 03 05:32 AM


All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"