Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Find and delete Both Dupblicate Cells in a list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Myrto - 17 Nov 2006 12:31 GMT
I have two lists. The list B contains some same cells with List A. How can I
find all the duplicate cells on list A and than delete both cells?
Gary''s Student - 17 Nov 2006 14:16 GMT
Enter and run this macro:

Sub myrto()
rw1 = Range("A" & Rows.Count).End(xlUp).Row
rw2 = Range("B" & Rows.Count).End(xlUp).Row

Set rDel = Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
For i = 1 To rw1
   v1 = Cells(i, "A").Value
   For j = 1 To rw2
       v2 = Cells(j, "B").Value
       If v1 = v2 Then
           Set rDel = Union(rDel, Cells(i, "A"), Cells(j, "B"))
       End If
   Next
Next
rDel.Delete Shift:=xlUp
End Sub
Signature

Gary's Student

> I have two lists. The list B contains some same cells with List A. How can I
> find all the duplicate cells on list A and than delete both cells?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.