Originally Posted by
sheeeng
Just an alternative,
Can anyone know how to use AdvancedFilter dunction to delete identical row?
I tried AdvancedFilter. But it only hide the identical row, which I do not need.
Please advise.
Thanks.
This is the approach I advocated
Sub DeleteRows()
Dim iLastRow As Long
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("G1").Value = "1"
Range("G2").Value = "2"
Range("G1:G2").AutoFill Destination:=Range("G1:G" & iLastRow)
Columns("A:F").Sort Key1:=Range("D1"), _
Order1:=xlAscending, _
Key2:=Range("E1"), _
Order2:=xlAscending, _
Key3:=Range("F1"), _
Order3:=xlAscending, _
Header:=xlNo
Columns("A:F").Sort Key1:=Range("A1"), _
Order1:=xlAscending, _
Key2:=Range("B1"), _
Order2:=xlAscending, _
Key3:=Range("C1"), _
Order3:=xlAscending, _
Header:=xlNo
Columns("H").Insert
Range("H1").Formula = _
"=(COUNTIF($A$1:A1,A1)+COUNTIF($B$1:B1,B1)+COUNTIF($C$1:C1,C1)+COUNTIF($D$1:D1,D1)+COUNTIF($E$1:E1,E1)+COUNTIF($F$1:F1,F1))>6"
Range("H1").AutoFill Destination:=Range("H1:H" & iLastRow), Type:=xlFillDefault
Rows("1:1").EntireRow.Insert
Range("H1").Value = "Temp"
Columns("H:H").AutoFilter Field:=1, Criteria1:="TRUE"
Rows("1:" & iLastRow + 1).SpecialCells(xlCellTypeVisible).Delete
Columns("A:G").Sort Key1:=Range("G1"), _
Order1:=xlAscending, _
Header:=xlNo
Columns("G:G").ClearContents
End Sub