Excel 2000 - 2003 Compatability problem with pivottables
Hi,
I came up with some code that creates a pivottable just the way I want it in Excel 2003. However, the code throws an error in Excel 2000 at the 'AddDataField' part. I've tried and tried to recreate the same effect in 2000 - anyone got any idea what the equivalent work around code would be? Thanks for any help Sub CreatePT() Set wksD.Range("rDataRangeCorner").CurrentRegion.Name = "rSourceData" ThisWorkbook.PivotCaches.Add(SourceType:=xlDatabas e, SourceData:="=rSourceData") _ .CreatePivotTable TableDestination:="=rDestination", _ TableName:="PivotTable1" Set ptPivot = wksP.PivotTables("PivotTable1") With ptPivot .ColumnGrand = False .PivotFields("Date").Orientation = xlRowField .PivotFields("Description").Orientation = xlRowField .PivotFields("P").Orientation = xlPageField .PivotFields("Month").Orientation = xlPageField .AddDataField ptPivot.PivotFields("Hours"), "Sum of Hours", xlSum .PivotFields("Value").Orientation = xlColumnField .AddDataField ptPivot.PivotFields("Value"), "Sum of Value", xlSum .DataPivotField.Orientation = xlColumnField 'Weird code to get rid of row subtotals .PivotFields("Date").Subtotals = Array(False, False, _ False, False, False, False, False, False, False, False, False, False) End With End Sub |
All times are GMT +1. The time now is 01:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com