Excel - delete rows when alike
Solved/Closed
Amy
-
Feb 11, 2010 at 03:48 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Feb 11, 2010 at 05:52 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Feb 11, 2010 at 05:52 PM
Related:
- Excel - delete rows when alike
- Delete my whatsapp account without app - Guide
- Excel marksheet - Guide
- Number to words in excel - Guide
- Excel apk for pc - Download - Spreadsheets
- Kernel for excel - Download - Backup and recovery
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Feb 11, 2010 at 05:52 PM
Feb 11, 2010 at 05:52 PM
Not entirely clear about this part "STD0182 - Transaction Ref"
Assumptions.
1. You want to delete a row if, its column B value is same as the value in the row above it
2. Data is sorted on column B
3. Column B Does not contain blank cell
Sub removeDups()
Dim myRow As Long
Dim sTRef As String
sTRef = Cells(2, 2)
myRow = 3
Do While (Cells(myRow, 2) <> "")
If (sTRef <> Cells(myRow, 2)) Then
sTRef = Cells(myRow, 2)
myRow = myRow + 1
Else
Rows(myRow).Select
Selection.Delete Shift:=xlUp
End If
Loop
End Sub
Assumptions.
1. You want to delete a row if, its column B value is same as the value in the row above it
2. Data is sorted on column B
3. Column B Does not contain blank cell
Sub removeDups()
Dim myRow As Long
Dim sTRef As String
sTRef = Cells(2, 2)
myRow = 3
Do While (Cells(myRow, 2) <> "")
If (sTRef <> Cells(myRow, 2)) Then
sTRef = Cells(myRow, 2)
myRow = myRow + 1
Else
Rows(myRow).Select
Selection.Delete Shift:=xlUp
End If
Loop
End Sub