+ Reply to Thread
Results 1 to 3 of 3

Macro to run autofilter to pick out data between two dates

  1. #1
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Macro to run autofilter to pick out data between two dates

    I am having trouble with the following macro,

    Please Login or Register  to view this content.
    When I press F8 and step through the macro, the StartDate and EndDate both seem to populate correctly.

    The macro seems to go through the motions but returns NO results, unlike the recorded macro.

    Could someone please shine a little light as to where I'm going wrong?

    Also, suggestion for macro code to "Clear Filter"

    Thanks
    Keith
    Last edited by kjg; 04-30-2014 at 05:24 PM. Reason: Extra info

  2. #2
    Registered User
    Join Date
    02-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Macro to run autofilter to pick out data between two dates

    I found the base for the filter below on stackoverflow.

    As it states in the thread dates are tricky.
    When I ran your code on my machine it was changing the date format from '02/01/2013' to '01/02/2013'.
    The solution is to filter the date as a real number, but it must be a date and not a string.



    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Thumbs up Re: Macro to run autofilter to pick out data between two dates

    Hi Ihmha,
    Thank you for your reply, I have inserted the code you posted and adjusted my macro and it is working "Perfectly"


    Cheers
    Keith

+ 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] Macro to Autofilter by 2 Criterias (Involving Dates)
    By 4everGS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2014, 12:32 PM
  2. Excel Macro to pick up data and write it on a .txt
    By ropbasuel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-14-2013, 02:58 PM
  3. Macro code for autofilter past dates
    By piyushchadha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-04-2013, 10:53 AM
  4. Replies: 9
    Last Post: 07-31-2012, 05:54 PM
  5. Macro to pick data from one worksheet to another
    By Denzil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2008, 04:55 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