PC Review


Reply
Thread Tools Rate Thread

Delete duplicates and more!

 
 
Ramses
Guest
Posts: n/a
 
      8th Dec 2006
I'm trying to delete duplicates lines. I have a list with 40.000
items
And the list looks some like this:

A42U002-49 (x)
A42U002-49-0
A42U002-50 (x)
A42U002-50-0
A42U002-50-0 (x)
A42U002-50-01
A42U002-51

All lines ending with -0 is the same as line without but not line with
-1.

So I have to delete all the line mark with (x)

Anyone have an Idea how to do this ?

 
Reply With Quote
 
 
 
 
kounoike
Guest
Posts: n/a
 
      8th Dec 2006
I'm not sure this will work in your case, but try this.
presuming data start from A1, and it will take some time if data many.

Sub deltest()
Dim start As Long, comp As Long
Dim endcell As Range
Application.ScreenUpdating = False
start = 1
comp = start + 1
Set endcell = Cells(Cells.Rows.Count, "a").End(xlUp).Offset(1, 0)
Do
If Cells(start, "a") <> Cells(comp, "a") Then
If start <> (comp - 1) Then
Rows(start + 1 & ":" & comp - 1).Delete
comp = start + 1
End If
start = comp
End If
comp = comp + 1
Loop Until (comp > endcell.Row)
start = 1
comp = start + 1
Set endcell = Cells(Cells.Rows.Count, "a").End(xlUp).Offset(1, 0)
Do
If Cells(start, "a") & "-0" = Cells(comp, "a") Then
Rows(start).Delete
Else
start = start + 1
comp = start + 1
End If
Loop Until (comp > endcell.Row)
End Sub

keizi

"Ramses" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to delete duplicates lines. I have a list with 40.000
> items
> And the list looks some like this:
>
> A42U002-49 (x)
> A42U002-49-0
> A42U002-50 (x)
> A42U002-50-0
> A42U002-50-0 (x)
> A42U002-50-01
> A42U002-51
>
> All lines ending with -0 is the same as line without but not line with
> -1.
>
> So I have to delete all the line mark with (x)
>
> Anyone have an Idea how to do this ?
>


 
Reply With Quote
 
Ramses
Guest
Posts: n/a
 
      8th Dec 2006
Thanks a lot
It takes some time but it works like a charm.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Duplicates with a Delete Query NEWER USER Microsoft Access Queries 3 22nd Mar 2009 01:49 PM
Find duplicates, sum column then delete duplicates aileen Microsoft Excel Programming 3 11th Dec 2008 05:03 PM
delete duplicates Darren Microsoft Access Queries 1 1st Jul 2008 01:35 PM
delete duplicates macro to color instead of delete DKY Microsoft Excel Programming 4 22nd Dec 2005 05:44 PM
Run duplicates query and delete duplicates? =?Utf-8?B?QnJvb2s=?= Microsoft Access Queries 1 5th Oct 2005 01:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:26 PM.