Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
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 -- Gary's Student "Myrto" wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SS has external ref. I want to delete but I cant find it anywhere | Charts and Charting in Excel | |||
How can I use find and replace to delete a word in Excel? | Excel Discussion (Misc queries) | |||
Find all from a list | Excel Discussion (Misc queries) | |||
Find and delete part of formula for multiple formulas? | Excel Worksheet Functions | |||
How do I find duplicate rows in a list in Excel, and not delete it | Excel Discussion (Misc queries) |