ListersPants
New Member
- Joined
- Nov 18, 2011
- Messages
- 3
Hi,
I have inserted a table with a before and after scenario.
If a Model (Column B) has a 'Transmission Start' and a 'Transmission End' (Column A) then I want to delete the whole row for that model for the row which contains 'Transmission Start'. So that it leaves the row for that model which has 'Transmission End'. In the below example Models 356 and 873 are deleted as they have a 'Transmission Start' and 'End'.
I have cobbled the below together but it simply deletes any row which contains 'Transmission Start'.
My data:
<tbody>
</tbody>
I have inserted a table with a before and after scenario.
If a Model (Column B) has a 'Transmission Start' and a 'Transmission End' (Column A) then I want to delete the whole row for that model for the row which contains 'Transmission Start'. So that it leaves the row for that model which has 'Transmission End'. In the below example Models 356 and 873 are deleted as they have a 'Transmission Start' and 'End'.
I have cobbled the below together but it simply deletes any row which contains 'Transmission Start'.
Code:
With ActiveSheet
.AutoFilterMode = False
With Range("a1", Range("a" & Rows.Count).End(xlUp))
.AutoFilter 1, "Transmission Start"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
My data:
Before | ||
Type | Model | |
<colgroup><col width="139"></colgroup><tbody> </tbody> | 356 | |
<colgroup><col width="139"></colgroup><tbody> </tbody> | 873 | |
<colgroup><col width="139"></colgroup><tbody> </tbody> | 356 | |
Transmission start | 896 | |
<colgroup><col width="139"></colgroup><tbody> </tbody> | 873 | |
Transmission start | 231 | |
Transmission end | 111 | |
After | ||
Transmission end | 356 | |
Transmission start | 896 | |
Transmission end | 873 | |
Transmission start | 231 | |
Transmission end | 111 | |
<tbody>
</tbody>