+ Reply to Thread
Results 1 to 9 of 9

Pivot Item. How to select only one.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Pivot Item. How to select only one.

    Hi everyone,

    I create a pivot table and want to apply a filter for only one item.

    For instance, if my data set has currencies. I would only want to see USD

    HTML Code: 
    I tried to do something like

    for each pivotitem in Pivot
    
    if pivotitem ="USD" Then .pivotitems("USD").visible = true 
    
    next pivotitem
    Unfortunately it did not work,
    any suggestions would be very helpful.
    Thanks in advance for your time.
    Philippe

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,173

    Re: Pivot Item. How to select only one.

    Which area of the pivot table is that field - row, column, or filter?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Pivot Item. How to select only one.

    Hi RomperStomper,

    It's in the Filter area.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,173

    Re: Pivot Item. How to select only one.

    In that case you want to set the Currentpage property of the field to "USD".

  5. #5
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Pivot Item. How to select only one.

    Thanks it works.

    Do you know if there is some sort of loop I could use to set pivotsitem visible or not visible.


    .pivotsitem(LoopVariable).visible = true

    Thanks again for your previous answer.
    very helpful.
    Philippe

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,173

    Re: Pivot Item. How to select only one.

    Yes, you can just loop through the PivotItems collection of the PivotField.

  7. #7
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Pivot Item. How to select only one.

    Thanks.

    How would a simple example look like?

    What I tried:

    Dim ItemPT as pivotfield
    for each ItempPT in PT
    
    if itemPT.name = "USD" then msgbox "it works"
    
    Next Itempt

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,173

    Re: Pivot Item. How to select only one.

    Dim ItemPT as pivotItem
    for each ItempPT in PT.PivotFields("some field").PivotItems
    
    if itemPT.name = "USD" then msgbox "it works"
    
    Next Itempt
    for example

  9. #9
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Pivot Item. How to select only one.

    Thank you so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select item of a dropdown list (data validation) and refresh one pivot table
    By ATN123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2014, 07:40 AM
  2. [SOLVED] Select item of a dropdown list (data validation) and refreshes values of all pivot tables
    By siroco79 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 03-06-2014, 05:35 AM
  3. Select Pivot Field Item
    By ShareTheGlobe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2013, 08:02 AM
  4. Select specific Pivot-table item
    By bobo1000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2012, 03:06 AM
  5. Select Combobox Item With List Item Select
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2011, 02:40 PM

Tags for this Thread

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