Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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

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
question about SUM - how to sum each for elements [email protected] Excel Worksheet Functions 5 February 5th 09 09:57 AM
XML elements in Excel likethesun Excel Discussion (Misc queries) 0 August 17th 07 02:09 AM
XML elements in Excel likethesun Excel Discussion (Misc queries) 0 August 17th 07 01:55 AM
Protection elements Eva Excel Discussion (Misc queries) 2 February 16th 07 09:58 AM
conditionally delete some elements from an array clui[_8_] Excel Programming 1 December 4th 03 01:21 AM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"