sassora
03-16-2008, 04:28 AM
I am trying to loop this so that I get about 20 pivot tables stacked on top of each other in a worksheet. I've tried without success, shouldn't this be simple to do?. Any ideas?
The fields I want to include in the other pivot tables are the same except the 1A will change to various other names.
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R8324C12").CreatePivotTable TableDestination:= _
"'[Judgements 0607.xls]Test'!R1C1", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:=Array( _
"Care Region", "CORegion"), ColumnFields:=Array( _
"Phase", "1A")
ActiveSheet.PivotTables("PivotTable1").PivotFields("1A").Orientation = _
xlDataField
The fields I want to include in the other pivot tables are the same except the 1A will change to various other names.
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R8324C12").CreatePivotTable TableDestination:= _
"'[Judgements 0607.xls]Test'!R1C1", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:=Array( _
"Care Region", "CORegion"), ColumnFields:=Array( _
"Phase", "1A")
ActiveSheet.PivotTables("PivotTable1").PivotFields("1A").Orientation = _
xlDataField