Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default delete dulipate rows by checking each and every cell in a row till end.


hi friends,

iam trying to write macro for delete rows in a set of data by checking
which row is greater than the other row and delete the lesser row.

for example

A B C D E F

1 1 0 1 1 0 1
2 1 0 0 1 0 1
3 0 1 0 0 1 0
4 1 0 1 0 1 1
5 0 0 1 0 0 1

FOR this data the marco should delete rows which are = to other rows

answer should be like this


A B C D E F

1 1 0 1 1 0 1
2
3 0 1 0 0 1 0
4 1 0 1 0 1 1
5


2ND row is delete because 1st row is greater than the 2nd row
5th row is deleted because 4th row is greater than the 5th row


can any one plz help me rearding this marco.
thanks

sreedhar


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile: http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=471039

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default delete dulipate rows by checking each and every cell in a row till end.

Sub ab()
Dim lastrow As Long, i As Long
Dim cell As Range, c As Range
Dim sStr1 As String, sStr2 As String
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
Set cell = Cells(i, 1).Resize(1, 6)
sStr1 = "": sStr2 = ""
For Each c In cell
sStr2 = sStr2 & c.Value
sStr1 = sStr1 & c.Offset(-1, 0).Value
Next
If sStr2 < sStr1 Then
cell.ClearContents
End If
Next
End Sub

--
Regards,
Tom Ogilvy




"sreedhar" wrote in
message ...

hi friends,

iam trying to write macro for delete rows in a set of data by checking
which row is greater than the other row and delete the lesser row.

for example

A B C D E F

1 1 0 1 1 0 1
2 1 0 0 1 0 1
3 0 1 0 0 1 0
4 1 0 1 0 1 1
5 0 0 1 0 0 1

FOR this data the marco should delete rows which are = to other rows

answer should be like this


A B C D E F

1 1 0 1 1 0 1
2
3 0 1 0 0 1 0
4 1 0 1 0 1 1
5


2ND row is delete because 1st row is greater than the 2nd row
5th row is deleted because 4th row is greater than the 5th row


can any one plz help me rearding this marco.
thanks

sreedhar


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile:

http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=471039



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default delete dulipate rows by checking each and every cell in a row till end.


thanks for u'r help TOM,

actually u'r marco is comparing 1st row with all remaing rows and
clearing the rows which are lessthan it.

but what i need extra in this code is after checking with the 1st
row it should check the remaining rows with next row(2nd row) and then
it should go for next row (3rd row if exist) else next row. like this
way......... till thelast row checks with all rows.


once again thanks for u'r help

sree


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile: http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=471039

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default delete dulipate rows by checking each and every cell in a row till end.

No, that actually isn't what my macro is doing.

It reproduces your results. If it did what you said, it would delete all
rows after the first in your example.

If that isn't what you want, your meandering additional description adds
little to my comprehension. Perhaps someone else can understand you.

--
Regards,
Tom Ogilvy



"sreedhar" wrote in
message ...

thanks for u'r help TOM,

actually u'r marco is comparing 1st row with all remaing rows and
clearing the rows which are lessthan it.

but what i need extra in this code is after checking with the 1st
row it should check the remaining rows with next row(2nd row) and then
it should go for next row (3rd row if exist) else next row. like this
way......... till thelast row checks with all rows.


once again thanks for u'r help

sree


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile:

http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=471039



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default delete dulipate rows by checking each and every cell in a row till end.


hi tom,


just i want to add some more to code to get the need result.


After clearing the entrie row , the row should be resize from the dow
row

for ex:

1 0 0 1 0
0 0 0 1 0
1 0 1 0 1
1 1 0 1 1
.................
. .......

after runing coding

1 0 0 1 0

1 0 1 0 1
1 1 0 1 1
...............
..............
after getting this output .
what i need is a marco for resize it to empty row from down
like this

1 0 0 1 0
1 0 1 0 1
1 1 0 1 1
.............
...............
can u plz, help regarding this......
thanks
sre

--
sreedha
-----------------------------------------------------------------------
sreedhar's Profile: http://www.excelforum.com/member.php...fo&userid=2758
View this thread: http://www.excelforum.com/showthread.php?threadid=47103

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
Copy cell contents in empty rows below it till any unempty row com vtmalhan Excel Discussion (Misc queries) 1 February 11th 08 11:26 AM
Delete rows on Cell wal50 Excel Discussion (Misc queries) 3 December 31st 07 12:52 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Checking specific cell, and identifing how many rows in the sheet Amy[_9_] Excel Programming 3 April 21st 05 03:57 PM
Delete rows after used cell? JayL. Excel Programming 1 October 30th 03 07:23 AM


All times are GMT +1. The time now is 11:36 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"