+ Reply to Thread
Results 1 to 5 of 5

How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table?

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    Placerville, California
    MS-Off Ver
    Excel 2010
    Posts
    2

    How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table?

    I am trying to filter an OLAP pivot table based on an external cell value and can;t find anything that works. Below is a snippet of my code that I'm trying to get working, so here is my question...How do I pass the "filterProj" variable value to the highlighted text? [0000006.00 - Information Technology]

    filterProj = Worksheets("Summary").Range("B2").Text

    ActiveSheet.PivotTables("PivotTable2").PivotFields( _
    "[Projects].[Project Tree by Number].[Project Number - Short Name]"). _
    CurrentPageName = _
    "[Projects].[Project Tree by Number].[Project Number - Short Name].&[0000006.00 - Information Technology]"

    Thanks,
    Heath

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table

    Heath

    Assuming that the [] are actually part of the variable then try

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    09-28-2012
    Location
    Placerville, California
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table

    Thank you very much rylo.

    The code that you posted gave me an Application-defined or object-defined error. I played around with the string and ended up with the following working without error.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-04-2017
    Location
    Romania
    MS-Off Ver
    2013
    Posts
    1

    Re: How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table

    really great this info;
    Do you know how to put multiple filter on same currpage?
    It seems with this syntax above only get one filter.
    Thx

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: How do I pass a variable to the CurrentPageName filter of an analysis cube pivot table

    Hi,

    You need to set the CurrentPageList using an array of strings in the aforementioned format.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1