+ Reply to Thread
Results 1 to 13 of 13

How to delete ALL duplicates cells

  1. #1
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    How to delete ALL duplicates cells

    Hi

    How to delete all duplicates in active column with excel VBA ?

    For example if i have 3 duplicate cells then delete all 3 cells.
    ( Don't leave one cell and delete the other two cells ).

    For example Please see the attached file before and after sheets

    Thank You.test.xlsx

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: How to delete ALL duplicates cells

    Why not next code

    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

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

    Re: How to delete ALL duplicates cells

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    Re: How to delete ALL duplicates cells

    Thank you, is working on the test file...

    but i have 150K records and a getting "not responding"

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: How to delete ALL duplicates cells

    With which code?
    Of course the active sheet is the one with the data ...
    Last edited by PCI; 10-21-2014 at 03:15 PM.

  6. #6
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    Re: How to delete ALL duplicates cells

    I tried the two codes

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete ALL duplicates cells

    You should run the code from the active sheet, i.e. before sheet on the attached sample.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    Re: How to delete ALL duplicates cells

    I tried the attachment

    I getting a "not responding" after adding 150k records and run the macro "testdeldup"

  9. #9
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: How to delete ALL duplicates cells

    try
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete ALL duplicates cells

    I have tried it on half millions rows and was not slow.
    It is difficult to comment on your data with out seeing it.
    Are these data imported in to excel from other application, like Oracle Finance or SAP?

  11. #11
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    Re: How to delete ALL duplicates cells

    Yes. I pull the data from sql server to Excel via "Excel connection"

    BUT I copy the column and paste as a text to a new Excel file.

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to delete ALL duplicates cells

    BUT I copy the column and paste as a text to a new Excel file.[/QUOTE]
    Does your PC make noises while the code is running? It is because the data are consuming lots of PC's memories.
    Well, this is known problem as imported data have unseen dirty characters.
    Copying the data again, but when you paste them paste the data as VALUES ONLY will get rid off some of the dirty data, but not entirely. Delete the old workbook after you saved the newly copied data.
    You could run a separate code which cleans the data, but that is another topic.

  13. #13
    Forum Contributor
    Join Date
    06-09-2008
    Posts
    124

    Re: How to delete ALL duplicates cells

    I found the solution, I did a sort to the column, and then deleted all the empty cells and then the macro worked Good

    Thank You!

+ 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. Macro to find duplicates, concatenate cells, then delete old duplicates
    By givemepuppies in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-04-2016, 02:43 AM
  2. Concatenate cells and delete duplicates
    By plente in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-17-2011, 07:19 PM
  3. Merge Cells(maybe) then delete duplicates
    By J_Tackett in forum Excel General
    Replies: 4
    Last Post: 04-21-2010, 09:07 AM
  4. Delete cells with duplicates
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2009, 11:28 AM
  5. combine cells and delete duplicates
    By megkelley in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-28-2007, 05:55 AM

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