PC Review


Reply
Thread Tools Rate Thread

Delete Duplicate row and Copy to another sheet

 
 
-jawad
Guest
Posts: n/a
 
      28th Aug 2007
Dear All:

I have following data, what I m trying to do, records where both HOC
and STS are same, irrespective of IDATE/SDATE/RL. it

should be deleted from sheet1 and be copied on sheet 2. Would it
possible in macro.


IDATE PNAME STS RL SDATE
13/08/2006 HOC AT Y 14/08/2006
13/08/2006 HOC AG Y 23/08/2006
13/08/2006 HOC AG H 24/08/2006
13/08/2006 HOC UP Y 27/08/2006
13/08/2006 HOC FILE H 30/08/2006
14/08/2006 IASS AT H 15/08/2006
14/08/2006 IASS AG H 19/08/2006
14/08/2006 IASS UP H 22/08/2006
14/08/2006 IASS WDT H 23/08/2006
14/08/2006 IASS FILE H 24/08/2006
14/08/2006 IASS FILE H 27/08/2006

After impelmention the data should be like this


IDATE PNAME STS RL SDATE
13/08/2006 HOC AT Y 14/08/2006
13/08/2006 HOC AG Y 23/08/2006
13/08/2006 HOC UP Y 27/08/2006
13/08/2006 HOC FILE H 30/08/2006
14/08/2006 IASS AT H 15/08/2006
14/08/2006 IASS AG H 19/08/2006
14/08/2006 IASS UP H 22/08/2006
14/08/2006 IASS WDT H 23/08/2006
14/08/2006 IASS FILE H 24/08/2006

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      28th Aug 2007
Something like this
Sub CopyDups()
Dim lastrow as Long, rw as Long
rw = 2
with worksheets("Sheet1")
lastrow = .cells(rows.count,2).end(xlup).row
for i = lastrow to 2 step -1
if .cells(i,2) = .cells(i-1,2) and _
.cells(i,3) - .cells(i-1,3) then
.rows(i).copy Worksheets("Sheet2").Cells(rw,1)
.rows(i).Delete
rw = rw + 1
end if
Next
End With
End Sub

--
Regards,
Tom Ogilvy


"-jawad" wrote:

> Dear All:
>
> I have following data, what I m trying to do, records where both HOC
> and STS are same, irrespective of IDATE/SDATE/RL. it
>
> should be deleted from sheet1 and be copied on sheet 2. Would it
> possible in macro.
>
>
> IDATE PNAME STS RL SDATE
> 13/08/2006 HOC AT Y 14/08/2006
> 13/08/2006 HOC AG Y 23/08/2006
> 13/08/2006 HOC AG H 24/08/2006
> 13/08/2006 HOC UP Y 27/08/2006
> 13/08/2006 HOC FILE H 30/08/2006
> 14/08/2006 IASS AT H 15/08/2006
> 14/08/2006 IASS AG H 19/08/2006
> 14/08/2006 IASS UP H 22/08/2006
> 14/08/2006 IASS WDT H 23/08/2006
> 14/08/2006 IASS FILE H 24/08/2006
> 14/08/2006 IASS FILE H 27/08/2006
>
> After impelmention the data should be like this
>
>
> IDATE PNAME STS RL SDATE
> 13/08/2006 HOC AT Y 14/08/2006
> 13/08/2006 HOC AG Y 23/08/2006
> 13/08/2006 HOC UP Y 27/08/2006
> 13/08/2006 HOC FILE H 30/08/2006
> 14/08/2006 IASS AT H 15/08/2006
> 14/08/2006 IASS AG H 19/08/2006
> 14/08/2006 IASS UP H 22/08/2006
> 14/08/2006 IASS WDT H 23/08/2006
> 14/08/2006 IASS FILE H 24/08/2006
>
>

 
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
copy duplicate rows to new sheet in WB =?Utf-8?B?U0lUQ0ZhblRO?= Microsoft Excel Programming 0 28th Jun 2006 07:53 PM
How do i delete duplicate rows in an Excel Spread Sheet =?Utf-8?B?c3FpcnQ=?= Microsoft Excel Worksheet Functions 1 8th Feb 2006 03:04 PM
DELETE DUPLICATE DATA IN A SHEET AUTOMATICALLY =?Utf-8?B?U29ueSBNYW5vag==?= Microsoft Excel Misc 1 20th Nov 2005 08:39 AM
Macro - to copy duplicate rows to another sheet miasmal@gmail.com Microsoft Excel Worksheet Functions 2 19th Apr 2005 01:53 AM
Sheet Copy Creates Duplicate Naming Error RSnyder Microsoft Excel Misc 1 8th Aug 2003 04:43 PM


Features
 

Advertising
 

Newsgroups
 


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