Excel - delete rows when alike
Solved/Closed
Amy
-
11 Feb 2010 à 15:48
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 11 Feb 2010 à 17:52
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 11 Feb 2010 à 17:52
Related:
- Excel - delete rows when alike
- Excel mod apk for pc - Download - Spreadsheets
- Sed delete line - Guide
- Kernel for excel repair - Download - Backup and recovery
- Excel online macros - Guide
- Vat calculation excel - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
11 Feb 2010 à 17:52
11 Feb 2010 à 17:52
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