Changing filter of pivot table with a cell value

  • Hello,


    I'm trying to change the filter of my pivot tables with a value in a cell.
    This is working, but I think it is a bit slow.


    And with this solution I can not put the pivot tables above each other. And that is what i want.



    Does anyone had a solution to have the code in such a way that I can put my pivot tables above each other?
    And does anyone know how I can make the code faster?


    Thanks in advance!

  • Re: Changing filter of pivot table with a cell value


    Sorry that I did not mentioned that.
    I am working with Excel 2007. I don't have the possibility to use 2010.


    So is there another solution?

  • Re: Changing filter of pivot table with a cell value


    I got the code a lot faster now.


    But I still can't put the pivot tables above each other.
    Does anyone has a solution for that?

  • Re: Changing filter of pivot table with a cell value


    I know now what the problem is, but still can't solve it.


    The problem is that i have to do this action:

    Code
    pt.PivotFields("Maand").ClearAllFilters


    and then this action:

    Code
    pt.PivotFields("Maand").PivotFilters.Add Type:=xlCaptionEquals, Value1:=maand


    When I clear the filter then the pivot tables overlap each other.


    Is there a way to apply a new filter and so replace the old one? Without removing it first.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!