Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try it.
Sub DeleteMatches() Dim k As Integer Dim i As Integer Dim j As Integer Dim MatchArray() k = 0 For i = ActiveSheet.Range("B65536").End(xlUp).Row To 2 Step -1 For Each Cell In ActiveSheet.Range("A2:A" & ActiveSheet.Range("A65536").End(xlUp).Row) If Cell.Value = ActiveSheet.Cells(i, 2).Value Then ActiveSheet.Cells(i, 2).Delete shift:=xlUp ReDim Preserve MatchArray(j) MatchArray(j) = Cell.Value End If Next Cell Next i If Not IsArray(MatchArray) Then For i = ActiveSheet.Range("A65536").End(xlUp).Row To 2 Step -1 For j = 0 To UBound(MatchArray) If ActiveSheet.Cells(i, 1).Value = MatchArray(j) Then ActiveSheet.Cells(i, 1).Delete shift:=xlUp End If Next j Next i End If End Sub -----Original Message----- Hi, Does anyone know, or point me in the right direction, how to have Excel find duplicate cells and delete them. For example, I have 2 columns of numbers. I need Excel to read the first cell in column A and look for a match in column B, and if it finds it, delete both. Then to repeat for the whole column. Any help would be appreciated. Thanks, Marc . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That's perfect!! Thanks many, many thanks! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find Duplicates Across Two Sheets, Delete Everything else. | Excel Worksheet Functions | |||
delete a spread sheet | Excel Worksheet Functions | |||
How do I find (not delete) duplicates in multiple spreadsheets? | Excel Worksheet Functions | |||
Duplicates in a spread sheet | Excel Worksheet Functions | |||
create a macro to search an excel spread for duplicates | Excel Worksheet Functions |