So even if a file has 20 columns of data, you want all 20 columns to be compared to each other for duplicates?
So even if a file has 20 columns of data, you want all 20 columns to be compared to each other for duplicates?
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
This is the code I usually use. It asks which column to check for duplicates and blanks.
Not the most efficient or best way at all but I personally like it. Good Luck![]()
Sub DeleteDuplicates() Dim colbox As String colbox = InputBox(Prompt:="Column to search for duplicates:", Title:="Column", Default:="A") colstring = colbox & ":" & colbox checkrow = 2 Application.ScreenUpdating = False Do Until checkrow = lastrow lastrow = ActiveSheet.UsedRange.Rows.Count matchcheck = Application.CountIf(Range(colstring), Cells(checkrow, colbox)) If matchcheck > 1 Then Cells(checkrow, colbox).EntireRow.Delete ElseIf Cells(checkrow, colbox) = "" Then Cells(checkrow, colbox).EntireRow.Delete Else checkrow = checkrow + 1 End If Loop Application.ScreenUpdating = True MsgBox ("Done deleting duplicates.") End Sub
![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks