I would like to take the data from a pivot table and compile it into a preset array or table.
How would I go about doing this?
Table would look like:
RPM/MAP 20 30 40 50 60 to 100
600
700
800
900
to
5200
Cells be complied of the O2 Averages in the pivot table below.
This is the pivot table I am using:
![]()
Sub Average() ' ' Average Macro ' ' ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "FuelData!R1C1:R1048576C3", Version:=xlPivotTableVersion12).CreatePivotTable _ TableDestination:="FuelData!R1C5", TableName:="PivotTable7", _ DefaultVersion:=xlPivotTableVersion12 Sheets("FuelData").Select Cells(1, 5).Select With ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable7").PivotFields(" MAP") .Orientation = xlRowField .Position = 2 End With With ActiveSheet.PivotTables("PivotTable7").PivotFields(" O2 Sensor 1") .Orientation = xlRowField .Position = 3 End With ActiveSheet.PivotTables("PivotTable7").AddDataField ActiveSheet.PivotTables( _ "PivotTable7").PivotFields(" O2 Sensor 1"), "Count of O2 Sensor 1", xlCount With ActiveSheet.PivotTables("PivotTable7").PivotFields("Count of O2 Sensor 1" _ ) .Caption = "Average of O2 Sensor 1" .Function = xlAverage .NumberFormat = "0.00" End With Range("E5").Select ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM").Subtotals = Array( _ True, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM"). _ LayoutSubtotalLocation = xlAtBottom With ActiveSheet.PivotTables("PivotTable7") .ColumnGrand = False .RowGrand = False .ShowDrillIndicators = False End With ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM"). _ LayoutSubtotalLocation = xlAtTop ActiveSheet.PivotTables("PivotTable7").PivotFields(" RPM").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) End Sub











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks