+ Reply to Thread
Results 1 to 8 of 8

*VBA* Only unique rows, but with one catch

  1. #1
    Registered User
    Join Date
    09-18-2014
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    33

    *VBA* Only unique rows, but with one catch

    Hi, I need a great deal of help making a macro.

    So I want to identify unique rows based on one of the columns, for example Name, or Employee ID, or Social and delete duplicate rows. But Also, I have a Column called Letter Code. If there is Specific Text in that column for that row (specifically "18C"), I need that to be the row that is kept when the macro is deleting duplicates.

    I know this sounds complicated, so I have attached a workbook with dummy raw data and desired output.

    Any input would be much appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: *VBA* Only unique rows, but with one catch

    Try the attached
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-18-2014
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    33

    Re: *VBA* Only unique rows, but with one catch

    I'm still having problems, it is taking a long time to process, as my data set is large, so it is freezing. Also this dummy data was for 4 columns but there are actually 16. I'm wondering if there is a more efficient way to do this.

    I Forgot to mention thanks for the help!

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: *VBA* Only unique rows, but with one catch

    See if this runs faster.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-18-2014
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    33

    Re: *VBA* Only unique rows, but with one catch

    Hi Jindon, thanks for the fast response. The macro is now processing very quickly, but there is 1 problem, it is not deleting duplicate rows properly. I would try to edit the code, but I have no idea what is actually going on. Is there any way you can change it so that the duplicates it deletes is based on column B?

    Thanks again for the help thus far.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: *VBA* Only unique rows, but with one catch

    Ok

    Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-18-2014
    Location
    Los Angeles, CA
    MS-Off Ver
    2013
    Posts
    33

    Re: *VBA* Only unique rows, but with one catch

    This is amazing, thank you.

    One last question, where do I change what to text look for in the letter code column?

    For example if I wanted it to look for "18C" or "18C - None" where would I type that?

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: *VBA* Only unique rows, but with one catch

    If that is the only condition then
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Otherwise, need to see all the combinations in that column.

+ 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] Delete a range of nearby rows where a cell = 0 (and loop to catch all)
    By jdodz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 08:09 PM
  2. Merge Duplicate Rows unique values into single rows for an infinite amount of columns/rows
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 08:43 PM
  3. Replies: 2
    Last Post: 02-06-2013, 04:44 AM
  4. [SOLVED] Applying unique ID's to rows but keep same unique ID number for duplicates
    By sirjames2829 in forum Excel General
    Replies: 2
    Last Post: 12-11-2012, 06:14 PM
  5. Replies: 1
    Last Post: 11-19-2012, 04:16 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