+ Reply to Thread
Results 1 to 3 of 3

Macro to filter pivot tables

  1. #1
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Macro to filter pivot tables

    Hi All,

    I'm new to macros and I am completely stuck. I am trying to filter a pivot table based on a date range using a macro. I have two cells where the start date and the end date will be inputted (using data validation) which will make up the date range. I've scoured through the forums and found a code that works, but it is written for several PTs which all have the same filter name. My problem is that I have several PTs but with different filter names (e.g. some are called "Date" others "PeriodDate"). Can anyone help me adapt this code (or any other which would do the trick) so it will run on only a single PT?

    Please Login or Register  to view this content.
    Thanks in advance,

    Darrel

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Macro to filter pivot tables

    The code that starts with the line "for each PT" and ends with the line "next PT" is especially designed to work with every pivot table on your sheet. You need to replace this with code that refers to your single pivot table.

    Replace the line that starts "for each...." With
    Please Login or Register  to view this content.
    Replace the line "next PT" with
    Please Login or Register  to view this content.
    To find out the full name of your pivot table, i suggest the following
    Turn on the macro recorder
    Click in the pivot table
    Click refresh
    Stop the macro recorder
    Look at the code - it will show you the full name of the pivot table. Use that name where indicated above.

  3. #3
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Macro to filter pivot tables

    Thanks so much Mallycat

+ 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