+ Reply to Thread
Results 1 to 8 of 8

Auto-Filter Pivot Table with New Month filter

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    16

    Auto-Filter Pivot Table with New Month filter

    Hello,

    I have a code that automatically updates my pivot tables based on the new data I put into a spreadsheet every month. I filter these pivot tables to show only data from the current month. Is there a way to include this in my VBA?

    For example:

    I have data from January-June. The pivot tables are currently filtered to show June data. I just added July. I run my macro and then have to manually change the filter to July.

    Please Login or Register  to view this content.
    Thank you!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Auto-Filter Pivot Table with New Month filter

    Quote Originally Posted by eskyec View Post
    Hello,

    I have a code that automatically updates my pivot tables based on the new data I put into a spreadsheet every month. I filter these pivot tables to show only data from the current month. Is there a way to include this in my VBA?

    For example:

    I have data from January-June. The pivot tables are currently filtered to show June data. I just added July. I run my macro and then have to manually change the filter to July.

    Please Login or Register  to view this content.
    Thank you!
    Can you record a macro where you manually change the filter to July and post the code here.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Auto-Filter Pivot Table with New Month filter

    Yes, thank you for your help

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Auto-Filter Pivot Table with New Month filter

    This will select the last month in the Month field list.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Auto-Filter Pivot Table with New Month filter

    what if the button to run the macro is on a different page. It worked when I was on the pivottables sheet but I run the macro by clicking a button on the final results sheet.

    it has a problem with the
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Auto-Filter Pivot Table with New Month filter

    Sorry! I have it figured out!!

    I have another question though. how can i make is reference a value in a cell.

    for example I can type "May" into a cell and it will then sort the pivot tables by may.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Auto-Filter Pivot Table with New Month filter

    Change this...
    .CurrentPage = .PivotItems(.PivotItems.Count).Name

    To something like this. Change the sheet name and range to suit.
    .CurrentPage = Sheets("Sheet1").Range("A1").Value

  8. #8
    Registered User
    Join Date
    06-13-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Auto-Filter Pivot Table with New Month filter

    Thank you very much for your help! Works like a charm!

+ 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. Filter pivot table according to current month
    By babbeleme1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2013, 07:32 PM
  2. Pivot Table Auto filter Change
    By tris1948 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-17-2013, 06:51 AM
  3. Pivot Table Macro to Auto Filter
    By DaFonz01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2012, 12:27 PM
  4. Pivot table filter by specific day of the month
    By vesapo in forum Excel General
    Replies: 2
    Last Post: 11-29-2010, 02:44 PM
  5. Auto filter and Pivot Table
    By RandyLewisKemp in forum Excel General
    Replies: 1
    Last Post: 05-26-2006, 03:15 PM

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