+ Reply to Thread
Results 1 to 3 of 3

Advanced Filter goes wrong when carried out by Macro

  1. #1
    Forum Contributor
    Join Date
    02-09-2007
    Location
    UK
    MS-Off Ver
    2019 & 365
    Posts
    304

    Advanced Filter goes wrong when carried out by Macro

    Please see the attached.

    When I recorded the marco which applies an advance filter to the data on 'dump data' sheet it gave me 35 results, plus the header in bold which is correct.

    When re-running the macro it seems to pull in the whole database from the 'dump data' sheet, not just the 35 records I would expect.

    I cant work out why it does this?

    Any ideas?

    Regards BVG
    Attached Files Attached Files
    Last edited by Badvgood; 11-15-2011 at 03:57 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Advanced Filter goes wrong when carried out by Macro

    Hi Badvgood
    I believe you have a "Date" issue. Attached are two files DB1.v2.xlsm and BD1 v2.1.xlsm.

    In DB1.v2.xlsm you're criteria is defined as Next.service.dateNext.service.date
    >=01/12/2011<=07/12/2011
    and it consistently returns 715 records

    In DB1.v2.1.xlsm I've defined the criteria as
    Next.service.dateNext.service.date>=12/01/2011<=12/07/2011
    and it consistently returns 35 records.

    So, it appears to be an issue of how the procedure is reading the dates. The procedure appears to be reading M/D/Y. Hope this helps.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Advanced Filter goes wrong when carried out by Macro

    Hi

    Does this bring you back your required data?

    Please Login or Register  to view this content.
    It does assume that the output range headings already exist on sheet1. If they don't then you will have to add code to bring them in.

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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