scan for repeating values and then delete

P

peach255 C

I would like to loop through Column B, and if I find the same repeating
value, then I would like to delete the rows and keep only one. I would
always have 4 replicates, but would only like to keep one. For ex., Loop
through Column B, and if found "A2" multiple times, then delete 3 out of
the 4 rows. The values would vary. I do not want to sort Column B first
though.

I have the following so far, and don't know how to check to see if the
values are repeating.

For lRow = Range(Cells(1, 2), Cells(Cells.Rows.Count,
2).End(xlUp)).Rows.Count To 1 Step -1
......
Next

Thank you!



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
C

Chong Moua

You don't have to use loops. Just use the advance filter
and check unique records only. See below...
------------------------------------
Sub FilterUnique()

Range("B:B").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("C1"), Unique:=True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top