+ Reply to Thread
Results 1 to 2 of 2

VBA code to filter pivot table by rows containing dates for dates < 60 months old

  1. #1
    Registered User
    Join Date
    06-04-2019
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    48

    VBA code to filter pivot table by rows containing dates for dates < 60 months old

    Hello again!!

    Just wondering if someone could help me out. I have a pivot table containing a large amount of data. My date field is inside the row area. I would like to filter the dates to contain only those dates to include only the information for the past 60 months. Currently I am working on a code like this:

    Please Login or Register  to view this content.
    wholeEndDate is a string made from user input to create today's date. The value looks like this: "05/31/2019".

    Unfortunately this is not working. Any help is much appreciated!!

    Dome

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

    Re: VBA code to filter pivot table by rows containing dates for dates < 60 months old

    This is a guess, but give it a try

    Please Login or Register  to view this content.
    It converts the date string to a date value, subtracts 60, and converts the new date value back to a date string.
    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.

+ 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: 1
    Last Post: 06-08-2019, 08:48 PM
  2. Pivot table - Filter by dates
    By HoyaBB in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-13-2017, 07:27 AM
  3. Filter recognizes dates, but Pivot Table filter does not
    By maw230 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-07-2016, 04:18 PM
  4. VBA Code to filter rolling dates from a pivot table
    By RavenousQbert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2014, 11:28 AM
  5. [SOLVED] VBA code to filter on Specific two dates ( pivot table)
    By tejal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-24-2014, 03:36 PM
  6. Select Multiple Dates In Report Filter Pivot Table But Dates Are Not Static
    By biasedobserver in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2014, 03:38 PM
  7. Pivot Table - Group Individual Dates Into Months
    By Kolin in forum Excel General
    Replies: 0
    Last Post: 07-15-2010, 11:02 AM

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