Creating Pivot VBA
Hey guys i wanted to create a pivot table with information from a table and put the pivot in another sheet. I did this code in Record Macro but doesnt work after I record it.
It gives me error "invalid Procedure call or argument" on the first line. Can someone help me understand what to change?
Sub PivotManual()
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"400 Iberica Not Sent!A1:A18", Version:=xlPivotTableVersion15). _
CreatePivotTable TableDestination:="400 Iberica Pivot!R1C1", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion15
Sheets("400 Iberica Pivot").Select
Cells(1, 1).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Personnel Number")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Start Date")
.Orientation = xlRowField
.Position = 2
End With
End Sub
Posted Apr 10, 2019, 2:42 PM UTC · edited
45