Deliverable7
New Member
- Joined
- Apr 9, 2016
- Messages
- 33
Hi Guys.
Can someone please help me to consolidate/simply the following code. I have a need to delete a number of rows in a large sheet that contain variable keywords (10) within a range of text strings in column A. Each key word only appears in the cells of column a once, the remaining text in the cell is variable.
I have a work around in that i run the Subs below through a call function, it works but is irritating. I know there is a 'better way'.
Thanks
Can someone please help me to consolidate/simply the following code. I have a need to delete a number of rows in a large sheet that contain variable keywords (10) within a range of text strings in column A. Each key word only appears in the cells of column a once, the remaining text in the cell is variable.
I have a work around in that i run the Subs below through a call function, it works but is irritating. I know there is a 'better way'.
Thanks
Code:
Sub DeleteRowsWithPROJECT()
Columns("A").Replace "*PROJECT*", "#N/A", xlWhole, , False, , False, False
On Error Resume Next
Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End Sub
Sub DeleteRowsWithNF()
Columns("A").Replace "*NF*", "#N/A", xlWhole, , False, , False, False
On Error Resume Next
Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End Sub
Sub DeleteRowsWithCLIENT()
Columns("A").Replace "*CLIENT*", "#N/A", xlWhole, , False, , False, False
On Error Resume Next
Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End Sub
Sub DeleteRowsWithNoofSAMPLES()
Columns("A").Replace "*# of SAMPLES*", "#N/A", xlWhole, , False, , False, False
On Error Resume Next
Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End Sub