Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
comparing rows and deletion
hi, i want to compare rows and delete the rows previously i got an marco help from the group but it is comparing the whole string of the row for example it is comparing rows 1 0 1 0 1 0 1 1 0 1 0 0 for these rows the marco is deleting the thrid row because 1010 is 0100 but it shouldn't delete it because we have to compare by cell by cell in the whole row 1 0 ,0 <1 ,1 0,0 = 0 but 0<1 so it should not delete the row. the marco is as follows 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, 100) 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 but i need a marco which compares cell by cell in the whole row and delete if all cells are than all cells in the other row else compare with other row till end of xlsheet. So, can any one plz help me A.S.P thanks sree -- sreedhar ------------------------------------------------------------------------ sreedhar's Profile: http://www.excelforum.com/member.php...o&userid=27582 View this thread: http://www.excelforum.com/showthread...hreadid=474533 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
rows identification and deletion | Excel Discussion (Misc queries) | |||
Automatic Deletion of Rows | New Users to Excel | |||
On deletion of rows | Excel Discussion (Misc queries) | |||
Deletion of rows where a value is satisfied | Excel Programming | |||
Deletion of rows where a value is satisfied | Excel Worksheet Functions |