Macro Error for Pivot Table

Occasional Contributor

I can create a Pivot Table for the data I download and it works fine.

However, when I made a Macro to do the same thing, I get an error. The error is: Run-time error '5':


The following is a screenshot of the highlighted error in the Macro. I am now using Excel 2013, however I made an initial Macro using an older version of Excel and am now trying to make a pivot table using 2013 and installing it near the start of the existing Macro I have.

Macro Error for Pivot TableMacro Error for Pivot Table

How do I correct for this error?

3 Replies

@WayneEK Does "Table1" exist? And what about the destination "Contract1 Report"?


If either one of those doesn't exist, or is even spelled differently, then that would cause the code to bug.


Thanks for replying. I confirmed the spelling and reference to the sheet and table is correct but am still getting the error. The only thing I can think it might be is that I should create a separate Sheet to put the Pivot Table on, instead of the existing sheet that the table is on. Thanks anyways.


@WayneEK try recording a new macro to create the pivot table then compare both codes