VBA Macro to Delete Duplicate Records In a Specified Column in Excel
For A = 1 To 100
Sub Trim_Del()
Dim A As Integer
Dim B As Integer
Dim c As Integer
Dim d As Integer
Dim x As Integer
On Error GoTo Label:
B = InputBox("Enter Column No. To Check For Duplicates:")
For A = 1 To 100
Cells(A, B).Offset(0, 1) = Application.Proper(Trim(Replace(Replace(Replace (LCase(Cells(A, B)), ".", " "), ",", " "), " ", " ")))
Next A
For c = 100 To 1 Step -1
For d = 100 To 1 Step -1
If d <> c Then
If Cells(d, B).Offset(0, 1) = Cells(c, B).Offset(0, 1) Then
x = x + 1
If x > 2 Then
Cells(c, B).Offset(0, 1).Delete shift:=xlUp
Application.ScreenUpdating = False
End If
End If
End If
Next d
Next c
Label:
End Sub
Thanks,Tamatam
Thanks,Tamatam
No comments:
Post a Comment
Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.