Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3
Default Find and delete Both Dupblicate Cells in a list

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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,058
Default Find and delete Both Dupblicate Cells in a list

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SS has external ref. I want to delete but I cant find it anywhere JSNoyes Charts and Charting in Excel 5 October 6th 06 02:48 PM
How can I use find and replace to delete a word in Excel? callpaultwt Excel Discussion (Misc queries) 2 December 1st 05 09:11 PM
Find all from a list vanjan Excel Discussion (Misc queries) 1 September 28th 05 04:10 PM
Find and delete part of formula for multiple formulas? coal_miner Excel Worksheet Functions 1 June 17th 05 05:41 PM
How do I find duplicate rows in a list in Excel, and not delete it Matthew in FL Excel Discussion (Misc queries) 2 June 15th 05 09:11 PM


All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"