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
>
|