PC Review


Reply
Thread Tools Rate Thread

Delete row with the same elements as the one above

 
 
Arno
Guest
Posts: n/a
 
      24th Nov 2008
Hello,

Is there a way to delete a rows that contain the same text/element as the
one above?

Many thanks

Arno

 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      24th Nov 2008
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 With Quote
 
Arno
Guest
Posts: n/a
 
      24th Nov 2008
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 With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      24th Nov 2008
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 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 row/s with the same elements as the above row Arno Microsoft Excel Programming 5 25th Nov 2008 08:33 AM
Can't delete elements in folder Recent elements Gudmund Liebach Nielsen Windows Vista General Discussion 0 16th Oct 2007 04:06 PM
Delete List elements shapper Microsoft ASP .NET 0 10th Oct 2007 02:25 AM
Delete elements in .NET collections headware Microsoft Dot NET Framework 3 12th Aug 2005 05:14 PM
How to search and delete elements from a XML file? richardkreidl@northwesternmutual.com Microsoft VB .NET 2 18th Apr 2005 04:58 PM


Features
 

Advertising
 

Newsgroups
 


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