Hello Excel gurus,
There are several examples of this task as long as it is a simple pivot table based on one table.
I am using multiple tables with power pivot. The filter field in this pivot table comes from the same table.
I have used the code below. It shows Type mismatch error# 13, no matter what changes I make to the data.

Please Login or Register  to view this content.
The error shows the "Set Field =" line.
The table TbleRev simply has the dates with day numbers, months, quarters, and years columns with revenue information.

The pivot table and the cell value to filter the pivot table are in different worksheets.
I am trying to filter years.

When I record a macro by changing the filter value, it shows this code:
Please Login or Register  to view this content.
I am not an Excel VBA expert. Please help.
Thank you in advance.