Hi There -
I am simply trying to create a pivot table using the macro recorder. After creating the code, I removed the previously created pivot table and attempted to run the routine again. However, I received a run-time error 5, invalid procedure call or argument error. The code is stopping at the bold section. Any thoughts? Thanks!
Sub Step2()
'
' Step2 Macro
'
' Keyboard Shortcut: Ctrl+b
'
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Rec 334!R1C1:R17C30", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Rec 334!R1C33", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion14
Sheets("Rec 334").Select
Cells(1, 33).Select
ActiveWindow.SmallScroll ToRight:=2
End Sub
I am simply trying to create a pivot table using the macro recorder. After creating the code, I removed the previously created pivot table and attempted to run the routine again. However, I received a run-time error 5, invalid procedure call or argument error. The code is stopping at the bold section. Any thoughts? Thanks!
Sub Step2()
'
' Step2 Macro
'
' Keyboard Shortcut: Ctrl+b
'
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Rec 334!R1C1:R17C30", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Rec 334!R1C33", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion14
Sheets("Rec 334").Select
Cells(1, 33).Select
ActiveWindow.SmallScroll ToRight:=2
End Sub