+ Reply to Thread
Results 1 to 7 of 7

Get unique values with VBA (advanced filter)

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 2016
    Posts
    416

    Get unique values with VBA (advanced filter)

    Hi all,

    I need to paste unique values (based on multiple criteria) from my data set to another sheet and want to use VBA in order to avoid using array formulas and slowing my file down significantly. I'm not that familiar with using advanced filtering, but that might be the best option, as it is an Excel built-in function? Open to other efficient solutions...

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by esbencito; 12-07-2018 at 04:24 AM. Reason: added first VBA attempt

  2. #2
    Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    577

    Re: Get unique values with VBA (advanced filter)

    try

    Please Login or Register  to view this content.
    Regards,
    MohanS


    "Perfection is not attainable, but if we chase perfection we can catch excellence." - Vince Lombardi

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,904

    Re: Get unique values with VBA (advanced filter)

    Another way.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 2016
    Posts
    416

    Re: Get unique values with VBA (advanced filter)

    mohan.r1980,

    This seems to ignore the 2 criteria I have...
    Last edited by jeffreybrown; 12-07-2018 at 08:12 AM. Reason: Removed full quote!

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 2016
    Posts
    416

    Re: Get unique values with VBA (advanced filter)

    bakerman2,

    Thanks. Great solution! A little slow in my actual data set though. Is there a more efficient way to do this, such as Advanced Filtering?
    Last edited by jeffreybrown; 12-07-2018 at 08:13 AM. Reason: Removed full quote!

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4,904

    Re: Get unique values with VBA (advanced filter)

    Try this for starters.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 2016
    Posts
    416

    Re: Get unique values with VBA (advanced filter)

    Thanks bakerman2!! This is a good start! Do you also happen to know how to filter only the unique items in "KEY PROGRAM"? It currently returns the item "STRETCH CHINO" twice. The "<>" sign in the criteria range is only used to get rid of the blanks I assume?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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