+ Reply to Thread
Results 1 to 6 of 6

looping through pivot table filter

  1. #1
    Registered User
    Join Date
    05-25-2014
    Posts
    34

    looping through pivot table filter

    Hi,

    I am trying to loop through each pivot item in the pivot table filter called 'COMPANY_NAME'

    This is the code I have so far but get an error on line 'PvItemL.Visible = False'

    Please Login or Register  to view this content.
    Can someone please give me a clue as to why this error comes up please?

    Thanks

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: looping through pivot table filter

    Maybe tell us what you're trying to achieve? You have 2 loops looping the same field.

    Let's say there are only three items in that field.
    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    05-25-2014
    Posts
    34

    Re: looping through pivot table filter

    Thanks millz for your speedy response...

    I have 7 pivot items which I want to loop through and check if C20 is greater than 20 and save as PDF if it's true.
    I have taken out one of the for loops but still get the same error.

    Any help?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: looping through pivot table filter

    Well, removing one of the loops will still end up the same because you are still going to hide everything eventually.

    The idea would be to make everything visible first in every loop, before hiding what you don't want to see. Try this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-25-2014
    Posts
    34

    Re: looping through pivot table filter

    Thanks millz, your solution worked

    One more question for the line
    Please Login or Register  to view this content.
    Why do I get an error when I put ("C6:C9")?

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: looping through pivot table filter

    Because you cannot compare a range of cells to a single value.

  7. #7
    Registered User
    Join Date
    05-25-2014
    Posts
    34

    Re: looping through pivot table filter

    oh okay, thanks milllz that makes sense

+ 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. Replies: 6
    Last Post: 07-31-2014, 12:56 PM
  2. Looping a pivot filter change & sending via email
    By johnoc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2014, 10:11 AM
  3. Pivot Table, Looping through Filter
    By noobtime in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2013, 05:53 PM
  4. Pivot table, assigning a cell wo be change the Pivot table filter
    By jwongsf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2012, 05:00 PM
  5. Pivot Table - Looping Through Pivot Fields
    By mini12 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-07-2009, 09:49 AM

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