Nicolaf
04-04-2014, 02:32 AM
Hi,
I have a code that deletes rows if text in column A is duplicated.
Sub DeleteDups()
Dim x As Long
Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then
Range("A" & x).EntireRow.Delete
End If
Next x
End Sub
I would like to change the code so that row is deleted if an identical row is found.
Rows have data in range A to C.
So for example for rows below in columns A to C:
apples green Italy
apples red Spain
apples green Italy
apples red Italy
Only row with "apples green Italy" should be deleted.
How do I amend my code to do this or is there another code I could use?
Unfortunately because I have Excel 2003
I cannot use
ActiveSheet.Range("$A$1:$C$4").RemoveDuplicates Columns:=Array(1, 2, 3), _
Header:=xlNoNix :(
I have a code that deletes rows if text in column A is duplicated.
Sub DeleteDups()
Dim x As Long
Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then
Range("A" & x).EntireRow.Delete
End If
Next x
End Sub
I would like to change the code so that row is deleted if an identical row is found.
Rows have data in range A to C.
So for example for rows below in columns A to C:
apples green Italy
apples red Spain
apples green Italy
apples red Italy
Only row with "apples green Italy" should be deleted.
How do I amend my code to do this or is there another code I could use?
Unfortunately because I have Excel 2003
I cannot use
ActiveSheet.Range("$A$1:$C$4").RemoveDuplicates Columns:=Array(1, 2, 3), _
Header:=xlNoNix :(