Deleteing Duplicate Rows???
James,
Here is a very quick way of doing it
Sub filterData()
Dim cRows As Long
Dim rng As Range
Dim testFormula As String
Application.ScreenUpdating = False
Columns("G:G").Insert
Rows(1).Insert
Cells(1, "G").Value = "Temp"
With ActiveSheet
cRows = .Cells(.Rows.Count, "F").End(xlUp).Row
testFormula = "=IF(COUNTIF(F$2:F2,F2)1,""Y"" ,"""")"
'create a test formula
.Cells(2, "G").Formula = testFormula
'copy the formula down all rows
.Cells(2, "G").AutoFill Destination:=.Range(.Cells(2, "G"), _
.Cells(cRows, "G"))
Set rng = .Range("G:G")
rng.AutoFilter Field:=1, Criteria1:="Y"
End With
rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
Columns("G:G").Delete
Application.ScreenUpdating = True
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"James" wrote in message
...
Hi Experts
I have a excel sheet of over 5000 rows of data (I get a
differnt one every week). Is their a way to delete a
duplicate, triplicate etc (it could have unlimited number
of same data) based on Value in Column A. i.e Value in
Column A are determining factor in deciding which row
should be considered duplicate.
I would ike to achieve this totaly through VBA in Excel
2002. I would appricate in your help if its possible.
Thanks a lot
James
|