+ Reply to Thread
Results 1 to 13 of 13

VBA to filter data after a date

  1. #1
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    VBA to filter data after a date

    Hello,

    I'm looking for a VBA to filter my data after a date. Presume this is something very small i've missed.

    This is what I currently have..

    Please Login or Register  to view this content.
    The date in cell J1 is 02/08/2013 (EU formatting).

    Any help would be great.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: VBA to filter data after a date

    Try this:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    Hi,

    Yes this is good, however 2nd august date needs to refer to cell J1 as it changes everyweek. Is there a way of doing this?

    Thanks

  4. #4
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    Anyone!? Surely can't be that hard unless you're me

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

    Re: VBA to filter data after a date

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    Quote Originally Posted by AB33 View Post
    Please Login or Register  to view this content.
    This doesn't work - it is simply running a macro and putting me back at step 1?

    Thanks

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

    Re: VBA to filter data after a date

    Please attach a sample.

  8. #8
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    Thanks AB, please see attached.

    Example workbook v74.xlsm

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

    Re: VBA to filter data after a date

    Okay,
    You criterion is not on the same sheet. It is in different sheet.
    What do you want to do once you filter the data?

  10. #10
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    My apologies.

    All I want to do is filter the data so that's all

    Thanks

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

    Re: VBA to filter data after a date

    Jonathan,
    Dates have been nightmare in excel. I have played around with different code and the problem is the date in J1 or P4. I have hard coded that is
    Please Login or Register  to view this content.
    It works, but as soon as I change the criterion to a range, it comes with some funny result. I have tried formatting and changing the data in to date format, but to no avail. When I formatted the P4 or J1 in to number format, it works.
    I do not know why 41488.00 works, but (02-aug-13) does not work.

    This code works with the date is formatted as number.

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    OK, great.

    So i'm trying to put this into the example workbook and it is not working. All it is doing is removing the filters from row 2.

    Please could you upload your example workbook so I can see?

    Many thanks.

  13. #13
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: VBA to filter data after a date

    I've come up with a solution for this - no date is ever going to be past 2099 so it would be easier to filter between two dates

    Cell S1 contains date 01/01/2099.

    Please Login or Register  to view this content.
    Thanks for all your help anyways

    Cheers

+ 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] How to Sort or filter Date/Time data
    By TheWookie in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-31-2013, 07:00 AM
  2. Date Filter is not working, beside filtering data also needs some help.
    By sanc.jobs2012 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-14-2012, 05:51 AM
  3. Filter data with date
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-19-2012, 01:47 PM
  4. Replies: 5
    Last Post: 12-13-2011, 12:40 AM
  5. Filter call data by open date
    By chris.howes in forum Excel General
    Replies: 1
    Last Post: 04-06-2006, 10:10 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