Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default How to delete CONSECUTIVE duplicate Rows

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to delete CONSECUTIVE duplicate Rows

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" wrote in message
...
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
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
delete duplicate rows, keep one Wasdell Excel Discussion (Misc queries) 1 October 30th 09 12:16 PM
delete duplicate rows christinaLO Excel Worksheet Functions 1 February 27th 07 06:22 PM
Delete duplicate rows Lupe Excel Programming 1 September 12th 06 03:11 PM
Delete duplicate rows christina Excel Programming 1 August 4th 03 01:04 PM
delete duplicate rows rhys Excel Programming 2 July 29th 03 12:52 PM


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

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"