rpaulson
Well-known Member
- Joined
- Oct 4, 2007
- Messages
- 1,382
hello,
the code below is, by far, the easiest and fastest I have ever seen to delete an entire row.
what I would like to know is how to tweak the about code to delete the entire row if it does NOT mach the criteria?
example: the above will delete the row if "John" is in Column A
I would like to delete the row if "John" is NOT in Column A
thanks for looking,
Ross
the code below is, by far, the easiest and fastest I have ever seen to delete an entire row.
VBA Code:
Sub DeleteRows() 'This macro will delete the entire row if there is a data match anywhere in the range.
With Range("A1:A:500")
.Replace "John", True, xlWhole ' can also use *John* if searching for any part
.SpecialCells(xlCellTypeConstants, 4).EntireRow.Delete
End With
End Sub
what I would like to know is how to tweak the about code to delete the entire row if it does NOT mach the criteria?
example: the above will delete the row if "John" is in Column A
I would like to delete the row if "John" is NOT in Column A
thanks for looking,
Ross