Excel/Macro for deleting duplicate rows
I am in need of a macro which works than the one listed below. I have a database of 72,000+ rows and there are lots of duplicates in the Column E. The macros I wrote is taking more 30 minutes to give me the actual data. Can you please help me out with a macro which runs pretty faster?
The macros I wrote is:
Dim x As Long
Dim LastRow As Long
LastRow = Range("E72700").End(xlUp).row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("E2:E" & x), Range("E" & x).Text) > 1 Then
Range("E" & x).EntireRow.Delete
Thanks in advance,
The macro LOOKS fine, but I'd suggest getting calculation turned to manual before it did it - alternatively, do this without a macro - which tends to be the way I do it - use a formula in a helper column which has a decreasing count if
this formula when dragged down will have a reducing count, so that the last entry each time has a one against it - to avoid calculation problems, copy this and paste special, values - and then filter on this column NOT EQUAL to one and delete the results.
A macro COULD be written to automate this if required.
let me know if you need further help with any of this - more than happy to help further.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here