+ Reply to Thread
Results 1 to 13 of 13

Add auto filter (unique records) option to macro

  1. #1
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Add auto filter (unique records) option to macro

    Hello, I have been modifying a workbook and the original macro will send to the sheet Results once the "Search" button is clicked, but I have found that this macro is displaying duplicate records. Can anyone help me put in an auto filter to find only unique records? My second workaround option is if someone can help me remove the go to/select sheet option from the "Search" macro so that a user will not automatically be sent to the Results tab and will instead hit the "Confirm Category Selection" button (which auto filters before sending the user to the Results tab). I would be forever indebted to any help people can provide, I am very very new to VBA and appreciate all the help I can get!
    Attached Files Attached Files
    Last edited by eurydice88; 12-23-2009 at 06:40 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Add auto filter (unique records) option to macro

    Hi eurydice88
    Can you zip the file?
    It just save bytes
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Hi Pike, thanks so much for your reply! I just added the zip file.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Add auto filter (unique records) option to macro

    Hi eurydice88
    do you have excel 2003 or 2007?

  5. #5
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Sorry I realized I should have added that to original post...I have 2007.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Add auto filter (unique records) option to macro

    You shouldn't really PM members as I think you know - you can always bump your thread.

    Isn't the problem that you have duplicate records in your dataset, and can you not do something about that?

  7. #7
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Yes, again I am very sorry, I just wasn't sure if anyone else was going to respond to the thread. You are right, I should have bumped the thread, again my apologies I was just getting worried I might not reach anyone.

    Yes the issue is that once you hit the Search button, duplicate records will populate the Results tab and I have been trying (with next to no success) to solve the problem. Any help would be wonderful at this point, I normally like to be proactive about things and I hate bugging people, but I have tried time and time again to fix the problem but I haven't been able to Again, I am really sorry about the trouble.

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Add auto filter (unique records) option to macro

    Don't worry, not a big deal.

    Is the problem that the code is finding the unique values in col C (sub-category) when it should be doing it for category (col D)?

    If that is the problem, try this. If not, come back.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Hi Stephen, thank you so much. I know that it is back-assward but I am actually trying to get unique records by sub-category and not category so the column C is correct (I modified the original excel sheet which pulled search criteria from that column, I tried to make it column D time and time again but it wouldn't give so I just changed my columns as a work around.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Add auto filter (unique records) option to macro

    Hi eurydice88
    When you first Initialize the userform you are copying the unique list for the listbox
    Why not place the total unique list into the results sheet then filter by Criteria1 in place

  11. #11
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Thank you both so much for your help!

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Add auto filter (unique records) option to macro

    Hi eurydice88
    what was your solution?

  13. #13
    Registered User
    Join Date
    12-17-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2002
    Posts
    15

    Re: Add auto filter (unique records) option to macro

    Hi Pike, I added in a new definition:

    Please Login or Register  to view this content.
    I've attached the finished workbook in case anyone else needs it as well.
    Attached Files Attached Files

+ 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