PC Review


Reply
Thread Tools Rate Thread

How to delete CONSECUTIVE duplicate Rows

 
 
=?Utf-8?B?RnJlZA==?=
Guest
Posts: n/a
 
      23rd Sep 2007
I need an Excel VBAfunction to delete CONSECUTIVE duplicate rows after the
first onw. Anyone have something to do this? I see a lot of scripts that
delete all consectutive rows, but none that keep the first. Thanks.

Here is a sample of the data:
9183.805 0x41 70 41 F6 2A 37 0
9183.815 0x41 70 41 F6 2A 37 0
9183.816 0x41 70 41 F6 2A 37 0
9183.825 0x41 70 41 F6 2A 37 0
9183.835 0x41 70 41 F6 2A 37 0
9183.846 0x41 70 41 F6 2A 37 0
9183.855 0x41 70 41 F6 2A 37 0
9183.957 0x41 A0 0 0 0 0 0
9184.057 0x41 A0 0 0 0 0 0
9184.136 0x47 B0 5B 93 DE 86 0
9184.144 0x47 B0 5B 93 DE 86 0
9184.152 0x47 B0 5B 93 DE 86 0
9184.157 0x41 A0 0 0 0 0 0
9184.160 0x47 B0 5B 93 DE 86 0
9184.167 0x41 A0 0 0 0 0 0
9184.168 0x47 B0 5B 93 DE 86 0
9184.176 0x47 B0 5B 93 DE 86 0
9184.184 0x47 B0 5B 93 DE 86 0
9184.192 0x47 B0 5B 93 DE 86 0
9184.200 0x47 B0 5B 93 DE 86 0

Here is what I need it to be:
9183.805 0x41 70 41 F6 2A 37 0
9184.136 0x47 B0 5B 93 DE 86 0
9184.157 0x41 A0 0 0 0 0 0
9184.160 0x47 B0 5B 93 DE 86 0
9184.167 0x41 A0 0 0 0 0 0
9184.168 0x47 B0 5B 93 DE 86 0

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      23rd Sep 2007
Public Sub ProcessData()
Const TEST_COLUMN As String = "B" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
If .Cells(i, TEST_COLUMN).Value = .Cells(i - 1,
TEST_COLUMN).Value Then
.Rows(i).Delete
End If
Next i

End With

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Fred" <(E-Mail Removed)> wrote in message
news:F27A6E60-605D-4782-AA38-(E-Mail Removed)...
>I need an Excel VBAfunction to delete CONSECUTIVE duplicate rows after the
> first onw. Anyone have something to do this? I see a lot of scripts that
> delete all consectutive rows, but none that keep the first. Thanks.
>
> Here is a sample of the data:
> 9183.805 0x41 70 41 F6 2A 37 0
> 9183.815 0x41 70 41 F6 2A 37 0
> 9183.816 0x41 70 41 F6 2A 37 0
> 9183.825 0x41 70 41 F6 2A 37 0
> 9183.835 0x41 70 41 F6 2A 37 0
> 9183.846 0x41 70 41 F6 2A 37 0
> 9183.855 0x41 70 41 F6 2A 37 0
> 9183.957 0x41 A0 0 0 0 0 0
> 9184.057 0x41 A0 0 0 0 0 0
> 9184.136 0x47 B0 5B 93 DE 86 0
> 9184.144 0x47 B0 5B 93 DE 86 0
> 9184.152 0x47 B0 5B 93 DE 86 0
> 9184.157 0x41 A0 0 0 0 0 0
> 9184.160 0x47 B0 5B 93 DE 86 0
> 9184.167 0x41 A0 0 0 0 0 0
> 9184.168 0x47 B0 5B 93 DE 86 0
> 9184.176 0x47 B0 5B 93 DE 86 0
> 9184.184 0x47 B0 5B 93 DE 86 0
> 9184.192 0x47 B0 5B 93 DE 86 0
> 9184.200 0x47 B0 5B 93 DE 86 0
>
> Here is what I need it to be:
> 9183.805 0x41 70 41 F6 2A 37 0
> 9184.136 0x47 B0 5B 93 DE 86 0
> 9184.157 0x41 A0 0 0 0 0 0
> 9184.160 0x47 B0 5B 93 DE 86 0
> 9184.167 0x41 A0 0 0 0 0 0
> 9184.168 0x47 B0 5B 93 DE 86 0
>



 
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 Consecutive Rows if counta(row #) is = Avi Microsoft Excel Programming 1 4th Aug 2008 03:31 PM
Transposing data from consecutive rows into non-consecutive rows econ Microsoft Excel Misc 0 10th Mar 2008 07:24 PM
highlight consecutive duplicate rows (re-sending) Phil Hellmuth Microsoft Excel Discussion 2 18th Jan 2008 10:44 PM
Eliminating duplicate records in consecutive rows of a column Larry Microsoft Excel Worksheet Functions 1 26th Jun 2004 01:42 AM
Eliminating duplicate records in consecutive rows of a column Larry Microsoft Excel Misc 1 26th Jun 2004 01:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 PM.