Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro find and delete duplicates in a spread sheet.

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   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default macro find and delete duplicates in a spread sheet.

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
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default macro find and delete duplicates in a spread sheet.

Hi
see
http://www.cpearson.com/excel/deleti...eDuplicateRows

--
Regards
Frank Kabel
Frankfurt, Germany


Marc wrote:
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro find and delete duplicates in a spread sheet.


That's perfect!! Thanks many, many thanks!


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default macro find and delete duplicates in a spread sheet.

Duplicate Files Deleter (http://DuplicateFilesDeleter.com) is a simple, but effective tool to locate duplicate files in one or more selected search paths. It scans the files and compares them based on Byte for Byte Comparison, which ensures 100% accuracy. You can then choose to delete the selected duplicate or original files. The program is multi-threaded and performs scans quickly.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default macro find and delete duplicates in a spread sheet.

Duplicate Files Deleter (http://DuplicateFilesDeleter.com) is a
simple, but effective tool to locate duplicate files in one or more
selected search paths. It scans the files and compares them based on
Byte for Byte Comparison, which ensures 100% accuracy. You can then
choose to delete the selected duplicate or original files. The
program is multi-threaded and performs scans quickly.


Sounds dubious! Please explain how there can be duplicate files in one
path.

Also, please explain how this relates to Excel VBA.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
Find Duplicates Across Two Sheets, Delete Everything else. waggett Excel Worksheet Functions 2 October 6th 09 02:01 PM
delete a spread sheet Mats Excel Worksheet Functions 5 September 30th 09 10:03 PM
How do I find (not delete) duplicates in multiple spreadsheets? Nelson[_2_] Excel Worksheet Functions 1 June 1st 08 02:49 AM
Duplicates in a spread sheet Martha Excel Worksheet Functions 3 January 14th 08 05:18 PM
create a macro to search an excel spread for duplicates jamalin Excel Worksheet Functions 4 February 16th 07 10:58 AM


All times are GMT +1. The time now is 11:05 AM.

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

About Us

"It's about Microsoft Excel"