I built this using the macro recorder, but it is giving me errors.
Here is what i am trying to do:
1. On the "New Round Template" worksheet, create a pivot table of the "Player List" worksheet - Range A2:A100
Seems easy enough... but get an invalid procedure call error.
I am building a pivot table to give the user an ability to select what players he wants ( just trying to create a list ).. I will then just copy/paste special data only to use as a range for another macro...
Sub Create_Players_Pivot()
Sheets("New Round Template").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Player List!R1C1:R1048576C1", Version:=xlPivotTableVersion12). _
CreatePivotTable TableDestination:="New Round Template!R1C1", TableName:= _
"PivotTable2", DefaultVersion:=xlPivotTableVersion12
Sheets("New Round Template").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"Please list all players")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"Please list all players")
.PivotItems("(blank)").Visible = False
End With
End Sub
Here is what i am trying to do:
1. On the "New Round Template" worksheet, create a pivot table of the "Player List" worksheet - Range A2:A100
Seems easy enough... but get an invalid procedure call error.
I am building a pivot table to give the user an ability to select what players he wants ( just trying to create a list ).. I will then just copy/paste special data only to use as a range for another macro...
Sub Create_Players_Pivot()
Sheets("New Round Template").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Player List!R1C1:R1048576C1", Version:=xlPivotTableVersion12). _
CreatePivotTable TableDestination:="New Round Template!R1C1", TableName:= _
"PivotTable2", DefaultVersion:=xlPivotTableVersion12
Sheets("New Round Template").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"Please list all players")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"Please list all players")
.PivotItems("(blank)").Visible = False
End With
End Sub