PC Review


Reply
Thread Tools Rate Thread

Cut/Paste Duplicates code?

 
 
=?Utf-8?B?ZnBkODMz?=
Guest
Posts: n/a
 
      14th Jun 2007
Following up on a previous post.

I have a list of data in columns A:I. I need to find all duplicate rows in
the used range based on the data in col G, cut the all duplicates and paste
into another worksheet in the workbook.

Tom Ogilvy provided the following routine, but this leaves behind 1 of the
duplicate rows. Lets say I have 3 rows that have the same data in col G, is
it possible to
cut and past all 3 rows into the other sheet? Thanks in advance for any help
you can provide.

Thanks!

Sub ABC()
Dim rng As Range, rng1 As Range
Set rng = Intersect(ActiveSheet.UsedRange.EntireRow, _
ActiveSheet.Columns(10))
rng.Formula = "=if(Countif($G$1:G1,G1)>1,na(),"""")"
On Error Resume Next
Set rng1 = rng.SpecialCells(xlFormulas, xlErrors)
On Error GoTo 0
If Not rng1 Is Nothing Then
rng1.EntireRow.Copy Worksheets("Sheet2").Range("A1")
rng1.EntireRow.Delete
Worksheets("Sheet2").Columns(10).ClearContents
End If
ActiveSheet.Columns(10).ClearContents
End Sub

 
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
Excel code convert to Access code - Concat & eliminate duplicates italia Microsoft Access Queries 1 12th Sep 2006 07:22 PM
Excel code convert to Access code - Concat & eliminate duplicates italia Microsoft Access 2 12th Sep 2006 06:13 PM
Excel code convert to Access code - Concat & eliminate duplicates italia Microsoft Access Macros 0 12th Sep 2006 05:04 PM
Excel code convert to Access code - Concat & eliminate duplicates italia Microsoft Excel Programming 1 12th Sep 2006 12:14 AM
Cut/Paste emails w/o duplicates =?Utf-8?B?anNhYXR3b3Jr?= Microsoft Outlook Discussion 1 22nd Jul 2006 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:14 AM.