+ Reply to Thread
Results 1 to 7 of 7

VBA Loops and Pivot tables

  1. #1
    Registered User
    Join Date
    06-22-2009
    Location
    New York, ny
    MS-Off Ver
    Excel 2007
    Posts
    4

    VBA Loops and Pivot tables

    first off im NO VBA pro.. im all self taught. mostly by reverse engineering recorded macros..

    now the question... is it possible to use a loop to filter pivot tables?

    current layout is:
    i have aprox 10-15 charts..... these are all generated from pivot tables....

    i am using an extended version of the following code to capture user input to filter the charts via filtering the pivot tables... but i have a feeling im doing it the "Long way" hence the quest for an easy loop...

    Please Login or Register  to view this content.
    it runs through the EXACT same sequence for each pivot table..... there has to be a faster way?
    Last edited by AndrewZ00; 05-24-2010 at 12:13 PM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: VBA Loops and Pivot tables...

    Please put code tags around your code so we can answer...
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    06-22-2009
    Location
    New York, ny
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Loops and Pivot tables...

    Quote Originally Posted by romperstomper View Post
    Please put code tags around your code so we can answer...
    sorry about that... was not familiar with the [code] tags.... it has been updated...
    - Andrew

    Business Analyst III
    WebMD

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: VBA Loops and Pivot tables...

    Are you doing the same things to every pivot table on the worksheet?

  5. #5
    Registered User
    Join Date
    06-22-2009
    Location
    New York, ny
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Loops and Pivot tables

    Yes they will all be filtered using the same input....

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: VBA Loops and Pivot tables

    Then you can use a For Each loop:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-22-2009
    Location
    New York, ny
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Loops and Pivot tables

    ahhh... see i knew there was an easy loop in there!!! thank you... that beats having to copy and paste the same 10 lines of code and change the pivot table name... 15 times... considering i use this style for MANY files!

    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)

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