Hello-
So I am trying to add a pivot table into a macro to sort my data. I just recorded the macro while setting up the pivot table I needed but now it has an error almost immediately. I changed a few things around hoping that would do it but nope. The red text is where the error is right now.
HELP!!!! please
Sub OperatorPivot()
'
' OperatorPivot Macro
'
'
Sheets("Map Data").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _"Map Data!R1C1:R644C17", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Operator Data!R1C1", TableName:="PivotTable5", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Operator Data").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable5").PivotFields("OPERATOR")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Bits to KOP")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
"PivotTable5").PivotFields("# Count Operator"), "Sum of # Count Operator", _
xlSum
End Sub
So I am trying to add a pivot table into a macro to sort my data. I just recorded the macro while setting up the pivot table I needed but now it has an error almost immediately. I changed a few things around hoping that would do it but nope. The red text is where the error is right now.
HELP!!!! please
Sub OperatorPivot()
'
' OperatorPivot Macro
'
'
Sheets("Map Data").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _"Map Data!R1C1:R644C17", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Operator Data!R1C1", TableName:="PivotTable5", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Operator Data").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable5").PivotFields("OPERATOR")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Bits to KOP")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
"PivotTable5").PivotFields("# Count Operator"), "Sum of # Count Operator", _
xlSum
End Sub