Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime 1004 error -- insert method of range class failed. | Excel Discussion (Misc queries) | |||
RUNTIME ERROR '1004' --- Select method of worksheet class failed | Excel Programming | |||
runtime error '1004' delete Method of Range Class Failed | Excel Programming | |||
runtime error '1004' delete Method of Range Class Failed | Excel Programming | |||
excel97: runtime error 1004 select method of range class failed | Excel Programming |