Apply filter to a pivot table from a selection on another page

  • Hi,
    I have several pivot tables in an excel spreadsheet which are linked to powerpoint to produce customer reports.
    Currently I have to go onto each pivot table and select the customer name i require to update every pivot.
    I want to tyoe in the customer name in one place and then run a macro to update each pivottable.
    I am very close but not quite there.
    This code puts the words 'mycustomer' as the filter for the pivot table whereas what I am looking for is the contents of the cell in B5 to be the filter.


    Sub Update_pivots()


    Dim MyCustomer As String


    Sheets("Instructions").Select
    MyCustomer = Range("B5").Value


    Sheets("Pivot").PivotTables("PivotTable3").PivotFields("Customer Name"). _
    CurrentPage = ("MyCustomer")


    End Sub


    If I use CurrentPage = MyCustomer I get the error message Run Time error 5 - Invalid procedure call or argument.


    Any help gratefull recieved. Thanks

  • Re: Apply filter to a pivot table from a selection on another page


    Hi - Thanks but there doesn't appear to be an answer in ther for what I'm looking for.
    I guess another way of asking my question is - why doesn't this work?...


    Sheets("Pivot").PivotTables("PivotTable3").PivotFields("Customer Name"). _
    CurrentPage = Worksheets("Instructions").Range("B5").Value


    This doesn't work either


    Sheets("Pivot").PivotTables("PivotTable3").PivotFields("Customer Name"). _
    CurrentPage = Worksheets("Instructions").Range("B5")


    I get 'run time error 5. invalid procedure call or argument.'


    I've alos tried variations such as
    Sheets("Pivot").PivotTables("PivotTable3").PivotFields("Customer Name"). _
    CurrentPage = Sheets("Instructions").Range("B5").Value

  • Re: Apply filter to a pivot table from a selection on another page


    Upload your file with multiple PTs and your macro tries.

Participate now!

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