Hi All,
I have been trying to insert a pivot on all the workseets of a workbook however I tried to record for the first one and try to repeat the same on all the sheets, but strange thing happens as the very first recorded also does not owrk onthe same sheet if I am trying to run it second time on the same work sheet after deliting the earlier pivot.
Tab name is "044-01010".
ActiveSheet.Next.Select
Range("A1").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"044-01010!R1C1:R29C15", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="044-01010!R2C18", TableName:="PivotTable2", _
DefaultVersion:=xlPivotTableVersion12
Sheets("044-01010").Select
Cells(2, 18).Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Project Code")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Transaction Amt"), "Sum of Transaction Amt", xlSum
But after I run the below code gets hilighted in yellow and code debugs.
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"044-01010!R1C1:R29C15", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="044-01010!R2C18", TableName:="PivotTable2", _
DefaultVersion:=xlPivotTableVersion12
I know I might be missing some silly thing but still cant figure it out..
Please guys any help in regards is much appreciated.
Bookmarks