+ Reply to Thread
Results 1 to 6 of 6

Pivot Field Select

  1. #1
    Registered User
    Join Date
    11-22-2010
    Location
    Ann Arbor, mi
    MS-Off Ver
    Excel 2003
    Posts
    3

    Pivot Field Select

    I have a pivot table and would like to select values 1,2,3 from the legend field where the table includes values 1,2,3,4,5. I find that when I use the macro recorder it is not selecting 1,2,3 but unselecting 4,5. This will cause a problem as the legend field values will vary (i.e.1,2,3,4,5,6,7 or 1,2,3,4) with more or less choices but always including 1,2,3 (not necessarily in order). How can I select only the three values I want, not deselect the values I do not want?

    Thanks,

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Pivot Field Select

    You could store the items of interest in an Array and process accordingly.

    Not much to go in terms of specifics but in general terms:

    Please Login or Register  to view this content.
    Modify SheetName, PivotTableName and PivotFieldName as appropriate

    We are still assuming that at least one of the items detailed in vArray exists in the designated field

  3. #3
    Registered User
    Join Date
    11-22-2010
    Location
    Ann Arbor, mi
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pivot Field Select

    I attempted below, however, at .PivotItems(vArray).Visible = True Run-time error '1004': Unable to get the PivotItems property of the PivotField class.

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 11-23-2010 at 01:40 PM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Pivot Field Select

    adgors, please ensure your VBA is always encased within Code tags per Forum RULES.
    For more information about these and other tags, found here
    Given this is your first code post I have edited your prior post on this occasion - going forward please be sure to post in accordance with the above (and all other) rules

    Presumably the three items within the vArray exist as Items within your Unit Liason field ?

    If you are unable to work the code please post a sample file - dummy names etc so as to avoid confidentiality issues

  5. #5
    Registered User
    Join Date
    11-22-2010
    Location
    Ann Arbor, mi
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pivot Field Select

    Apologies, I will review the rules and be sure to encase VBA within code tags.

    That is correct. Unit Liaison is the column label (Pivot Table is used to generate Pivot Chart) and contains the vArray values.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Pivot Field Select

    As mentioned it would be best to demonstrate via sample file - dummy names etc as nec.
    (to attach a file click paperclip icon - if you can not see it click GoAdvanced and proceed from there)

+ 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