+ Reply to Thread
Results 1 to 6 of 6

Filtering dates

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Filtering dates

    Hi guys,

    I'm trying to filter dates through VBA.
    Macro recorder gives me this:
    Please Login or Register  to view this content.
    If I apply that like this, it won't work. It errors out. It does apply a filter with no results if I change Criteria2 to Criteria1.
    Please Login or Register  to view this content.
    arr is a string that is as below:
    2, "7/18/2015", 2, "7/25/2015", 2, "8/1/2015", 2, "8/8/2015", 2, "8/15/2015", 2, "8/22/2015", 2, "8/29/2015", 2, "9/5/2015"

    What am I doing wrong?

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Filtering dates

    Really... Noone.....?

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Filtering dates

    Hi Jasper,
    What is criteria 2?
    Should be criteria 1 and in front of the array.
    Like

    Please Login or Register  to view this content.
    If you have a vertical data, you need to use transpose them

    Please Login or Register  to view this content.
    Last edited by AB33; 09-07-2015 at 03:25 PM.

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Filtering dates

    Hi AB33,

    thanks for your reply - I was also wondering why the macro recorder comes up with Criteria2 - but it works when recorded. Just when trying to replicate it, it wouldn't.
    And how do you mean vertical data? It's data per cell, right? Would I still need to transpose?

    Thanks,

    Jasper

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Filtering dates

    A1:A10 is vertical A1:B1 is horizontal.
    It could be there is no match for the filter criteria as you have spaces in your array. If the data are in a range, load the range in to an array and filter the array or set the data as a range.
    One of these lines

    Please Login or Register  to view this content.

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Filtering dates

    Hi AB33,

    sorry for the late reply - your simple solution of picking up the 'arr' as below works fine.
    Final code:
    Please Login or Register  to view this content.
    Thanks for your help!

+ 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. [SOLVED] Filtering Dates
    By Gard5096 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2013, 02:02 PM
  2. Filtering Dates
    By teck91 in forum Excel General
    Replies: 5
    Last Post: 03-01-2010, 11:35 AM
  3. Filtering Dates (need all dates within the next 30 days)
    By debesh_b in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2008, 10:27 PM
  4. Filtering dates
    By ilsej in forum Excel General
    Replies: 1
    Last Post: 08-21-2008, 05:42 AM
  5. filtering dates
    By Ron de Bruin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 10:05 AM
  6. filtering dates
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 06:05 AM
  7. filtering dates
    By [email protected] in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  8. filtering dates
    By [email protected] in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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