• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code for slicer to select items from the text in a range of cells

ironk4699

New Member
Hi,

I'm fairly new to VBA and stuck on a problem. I have code that works to select a static list of items in a Slicer, but I would like to update it and make it dynamic based on a range of returned values in a range, for example A1:A6 (or last cell with data). How would I go about modifying this.

Below is what I currently have, where the A1/2/3 Text are the cells that are hardcoded names I would like dynamic based on a range of cells.

Thank you in advance for your help.
Code:
ActiveWorkbook.SlicerCaches("Slicer_Master_Project_ID_And_Name"). _
        ClearManualFilter
    ActiveWorkbook.SlicerCaches("Slicer_Master_Project_ID_And_Name"). _
        VisibleSlicerItemsList = Array( _
        "[Projects].[Master Project ID And Name].&[A1 Text]", "[Projects].[Master Project ID And Name].&[A2 Text]", _
        "[Projects].[Master Project ID And Name].&[A3 Text]", "[Projects].[Master Project ID And Name].&[A4 Text]", _
        "[Projects].[Master Project ID And Name].&[Last cell in A range with text]",
 
Last edited by a moderator:
Back
Top