Awhile back, I asked for a macro to delete the whole row if a duplicate customer number was found in column B. Sometimes, though, my column numbers change. So, logically thinking, I simply changed the criteria, but the macro ONLY seems to work if duplicate customer numbers are in column B only.
This code below won't work if the Customer Number is in column D instead of B even if the reference of B:B is changed to D:D, it doesn't carry the macro over...Why?
Sub Delete_Dup_Customer_Numbers()
r = 1
Do
Do While Application.WorksheetFunction.CountIf(ActiveSheet.Range("B:B"), Cells(r, 2)) > 1
ActiveSheet.Range("B:B").Find(Cells(r, 2), Cells(r, 2)).EntireRow.Delete
Loop
r = r + 1
Loop Until Cells(r, 2) = ""
End Sub
Thanks
Bookmarks