Hi I am facing problem in running macro that captured the pivot table creation. I used excel 2016 to create the macros. VBA Pivot Table Run Time Error 5 Invalid Procedure Call for MS office 2016 From this line i get the error: invalid procedure call or argument ActiveWorkbook.Worksheets("page2").PivotTables("PivotTable1").PivotCache. _ CreatePivotTable TableDestination:="page3!R3C1", TableName:="PivotTable1" _, DefaultVersion:=6
Sub PIVOT()
'
' PIVOT Macro
'
'
Sheets("page1").Select
Sheets.Add
**ActiveWorkbook.Worksheets("page2").PivotTables("PivotTable1").PivotCache. _
CreatePivotTable TableDestination:="page3!R3C1", TableName:="PivotTable1" _
, DefaultVersion:=6**
Sheets("page3").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("fruit")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("fruit"), "Count of fruit", xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("description")
.Orientation = xlPageField
.Position = 1
End With
ActiveWindow.SmallScroll Down:=-3
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Actual")
.Orientation = xlColumnField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").PivotFields("description"). _
ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("description"). _
CurrentPage = "group"
Range("B15").Select
End Sub