Comparing cells and in multiple columns
Solved/Closed
Reza
-
Feb 1, 2010 at 10:40 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Feb 1, 2010 at 10:55 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Feb 1, 2010 at 10:55 AM
Related:
- Comparing cells and in multiple columns
- How to lasso multiple objects in photoshop - Guide
- Display two columns in data validation list but return only one - Guide
- Allow multiple downloads chrome - Guide
- How to delete multiple files on mac - Guide
- Tweetdeck larger columns - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Feb 1, 2010 at 10:55 AM
Feb 1, 2010 at 10:55 AM
It will delete duplicate row (when item and price is same) and will delete the lower prices
If ActiveSheet.AutoFilterMode Then
Cells.Select
Selection.AutoFilter
End If
Cells.Select
Selection.Sort _
Key1:=Range("a2"), Order1:=xlAscending, _
Key2:=Range("b2"), Order2:=xlDescending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
lrow = 2
Do While (Cells(lrow, 1) <> "")
If Cells(lrow, 1) = Cells(lrow + 1, 1) Then
Rows(lrow + 1).Delete
Else
lrow = lrow + 1
End If
Loop
If ActiveSheet.AutoFilterMode Then
Cells.Select
Selection.AutoFilter
End If
Cells.Select
Selection.Sort _
Key1:=Range("a2"), Order1:=xlAscending, _
Key2:=Range("b2"), Order2:=xlDescending, _
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
lrow = 2
Do While (Cells(lrow, 1) <> "")
If Cells(lrow, 1) = Cells(lrow + 1, 1) Then
Rows(lrow + 1).Delete
Else
lrow = lrow + 1
End If
Loop