View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Macro needed to delete rows

Sub DeleteDups()
Dim lastrow as Long, i as Long
Dim rng as Range
With Worksheets("Sheet1")
lastrow = .Cells(rows.count,"A").End(xlup).Row
for i = lastrow to 2 step - 1
set rng = .Range(.cells(1,"A"),.Cells(i-1,"A"))
if application.Countif(rng,.cells(i,"A").Value)0 then
rows(i).Delete
end if
Next
End With
End Sub

--
Regards,
Tom Ogilvy


"simmerdown" wrote:

I have a list of numbers that I want to narrow down to unique numbers....in
other words, I want to delete the row if a number show is already displayed
elsewhere.

Example list:

1
2
2
2
3
4
4
4

I am searching for a macro that will delete the rows containing the extras
"2's" and "4's".