ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change pivot filter through code (https://www.excelbanter.com/excel-programming/420569-change-pivot-filter-through-code.html)

Basil

change pivot filter through code
 
Hi,

I've posted before on this, but had no luck - annoying as I know it is
possible since I've done it myself in the past (but lost the file!).

I have 2 pivot tables on a sheet which both have the same report filters.

When I change the filter selection on pivot table 1, I want (assumingly
through code) for pivot table 2 to automatically apply the same report filter.

Hope u can help,

Thanks,

Basil

Basil

change pivot filter through code
 
I did it eventally. It seems that Excel 2003 onwards can have issues with
this. My code was correct in the first place but I had to rebuild everything.
Also although I would assume that I could reference the current page of one
pivot table to set the current page of the other pivot table, Excel coud not
get it, so I had to reference a cell that pointed at the current page of the
pivot table:

If Range("Piv_Sport") < Range("Piv_Sport_Check") Then
Range("Piv_Sport_Check") = Range("Piv_Sport")
ActiveSheet.PivotTables("Weekly").PivotFields("Spo rt").CurrentPage =
Range("Piv_Sport").Value
Else
Range("Piv_Market_Check") = Range("Piv_Market")
ActiveSheet.PivotTables("Weekly").PivotFields("Mar ket
Search").CurrentPage = Range("Piv_Market").Value
End If

Basil

"Basil" wrote:

Hi,

I've posted before on this, but had no luck - annoying as I know it is
possible since I've done it myself in the past (but lost the file!).

I have 2 pivot tables on a sheet which both have the same report filters.

When I change the filter selection on pivot table 1, I want (assumingly
through code) for pivot table 2 to automatically apply the same report filter.

Hope u can help,

Thanks,

Basil



All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com