![]() |
Delete row with the same elements as the one above
Hello,
Is there a way to delete a rows that contain the same text/element as the one above? Many thanks Arno |
Delete row with the same elements as the one above
Hi,
There almost certainly is but you need to be more specific. What do you want to compare? the entire row i.e. every cell or just 1 cell with the row above/ Mike "Arno" wrote: Hello, Is there a way to delete a rows that contain the same text/element as the one above? Many thanks Arno |
Delete row with the same elements as the one above
Hi Mike,
the entire row above - Thanks "Mike H" wrote: Hi, There almost certainly is but you need to be more specific. What do you want to compare? the entire row i.e. every cell or just 1 cell with the row above/ Mike "Arno" wrote: Hello, Is there a way to delete a rows that contain the same text/element as the one above? Many thanks Arno |
Delete row with the same elements as the one above
Hi Arno, Try this:
Sub delMatchedRows() Dim lr As Long, x As Long Dim c As Range lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For i = lr To 2 Step -1 For Each c In Rows(i).Cells If c.Value < c.Offset(-1, 0).Value Then x = x + 1 End If Next If x = 0 Then Rows(i).Delete End If x = 0 Next End Sub "Arno" wrote: Hi Mike, the entire row above - Thanks "Mike H" wrote: Hi, There almost certainly is but you need to be more specific. What do you want to compare? the entire row i.e. every cell or just 1 cell with the row above/ Mike "Arno" wrote: Hello, Is there a way to delete a rows that contain the same text/element as the one above? Many thanks Arno |
All times are GMT +1. The time now is 09:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com