Have you tried filtering the data directly in the worksheet instead (Autofilter or Advanced filter)? Filtering out duplicates from 10,000 records takes seconds, not minutes. For example, this will remove all duplicate values from the data in column A.
Sub main() Dim ws As Worksheet Dim rng As Range Dim rngToDelete As Range Set ws = Worksheets("Sheet1") 'Advanced Filter requires a header row - let's add a temporary one ws.Rows(1).Insert ws.Cells(1, 1).Value = "temp header" Set rng = ws.Range("A1:A10000") rng.AdvancedFilter xlFilterInPlace, unique:=True Set rngToDelete = rng.SpecialCells(xlCellTypeVisible) ws.ShowAllData rngToDelete.EntireRow.Hidden = True rng.SpecialCells(xlCellTypeVisible).EntireRow.Delete rngToDelete.EntireRow.Hidden = False 'remove the temporary row ws.Rows(1).Delete End Sub




Reply With Quote