+ Reply to Thread
Results 1 to 10 of 10

How to remove unique rows (macro)?

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    How to remove unique rows (macro)?

    I currently have macro that removes any duplicates.
    Please Login or Register  to view this content.
    But I would love to have the opposite, so it would delete all unique rows and would keep the ones that are duplicates.
    Cheers
    Rain
    Is this possible?
    Last edited by rain4u; 02-03-2011 at 07:29 PM. Reason: typos

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

    Re: How to remove unique rows (macro)?

    Hi rain4u,

    Try this - just change the 'strMyCol' and 'lngStartRow' variables to suit and then run the macro initially on a copy of your data in case the results are not as expected:

    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

  3. #3
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: How to remove unique rows (macro)?

    I only amended the col to E and title of the macro.
    Please Login or Register  to view this content.
    On exec it starts to think and then crashes, have to task manager and end it.

    I do have 31000 lines on that spreadsheet.



    Any solution?

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

    Re: How to remove unique rows (macro)?

    A majority of the items in Column E must be unique as the 'rngDelRange' range is too large to set.

    Try this, which though slower (as it deletes each row when needed to be deleted instesd of all at once at the end), should do the job:

    Please Login or Register  to view this content.
    Robert

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to remove unique rows (macro)?

    Another way:
    Please Login or Register  to view this content.
    Last edited by shg; 02-04-2011 at 02:06 PM. Reason: correction
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: How to remove unique rows (macro)?

    With shg-s code it prompts up compile error @User defined type not defined@
    and highlights
    Please Login or Register  to view this content.
    With Roberts code it would probably remain doing it for longer periods. Was still going on after 5-10 min. Ended it then. And you are correct there are more uniques than duplicates.


    Any ideas?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to remove unique rows (macro)?

    In the VBE, Tools > References > find and tick Microsoft Scripting Runtime

  8. #8
    Registered User
    Join Date
    10-08-2010
    Location
    MK, UK
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: How to remove unique rows (macro)?

    Hi shg

    Could this be changed to remove all uniue rows, i.e. not leaving the lowest two values ?

    example

    rows with in column A = 1,2,3,3,4,4,4,5,5,6 would be left like 3,3,4,4,4,5,5

    Cheers
    David

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to remove unique rows (macro)?

    Please start your own thread, David, and provide a link to this one if you like.

    When you do, please post a workbook and explain in context.

    Thanks.

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: How to remove unique rows (macro)?

    Please Login or Register  to view this content.



+ 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