VBA - Filtering a pivot table based on an array - Not working

  • Hi,


    I have a document with a pivot table in my worksheet. The aim of my VBA code is to filter the pivot table based on an array of customers. Once I run the code its not filtering the table.


    I can select one customer and run the code again and it selects all. I have attached the code and images to show the 1st column is the array of customers and to the right is the pivot table.


    thanks,

  • It looks like you are using an OLAP pivot so you need an array that you assign to the VisibleItemsList property of the field. All the array items should be of the format "[Customers].[Customer].[customer name here]"

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

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