+ Reply to Thread
Results 1 to 5 of 5

Macro to get unique values from range of cells?

  1. #1
    Registered User
    Join Date
    04-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Macro to get unique values from range of cells?

    Hi guys, got a question relating to vba. I've done some coding so know roughly what I need to do, just don't have that much experience in excel/ vb.

    So, what I want to do is get all the unique values from a range of cells and print them in another range of cells, one value per cell. For example, this would be the result:
    Original List Result of Macro
    a a
    a b
    b c
    c
    a
    I assume this would be done by putting the values into an array and then printing that array with some kind of loop (but please correct me if I'm wrong, that guess is based off other code applicaitons).

    If possible it'd be great if the macro ignored cells with commas in them e.g. if the contents of a cell was "a,b" it would just skip that cell.

    Thanks for any help in advance, and sorry for the newbie question!

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to get unique values from range of cells?

    Maybe:

    Please Login or Register  to view this content.
    Results from Column A to Column B.

  3. #3
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Macro to get unique values from range of cells?

    Another one.. much the same as JHD's..

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to get unique values from range of cells?

    Thanks guys, will try out now!

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Macro to get unique values from range of cells?

    Hi wyndham29,

    Here's my attempt which also takes into account your request to ignore cells with commas and has some commentary about what the code is doing:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ 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] Formula or VBA - Comparison CSV Values between 3 cells for used range. Find unique values.
    By grphillips in forum Excel Programming / VBA / Macros
    Replies: 36
    Last Post: 06-09-2014, 02:12 PM
  2. [SOLVED] Find unique values from range ( populated cells only) & not count zeros or NA errors VBA
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2014, 06:50 AM
  3. [SOLVED] find unique values in a range that contains text and empty cells
    By bombicci in forum Excel General
    Replies: 4
    Last Post: 07-04-2012, 09:17 AM
  4. Replies: 3
    Last Post: 09-20-2011, 05:05 PM
  5. [SOLVED] force unique values in a range of cells?
    By keithb in forum Excel General
    Replies: 1
    Last Post: 08-08-2005, 04:05 PM

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