View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Zone Zone is offline
external usenet poster
 
Posts: 269
Default keyword search and delete row

Here's an alternate way to do it. Might be a bit crude, but it's
simple and effective. Copy and put in a standard module. Change Const
WordToFind to whatever it is you want to find. Change Const Col to
whatever column you want to look in. Sub presumes sheet is not
protected. Also note that it will delete if "draw", "Draw", or "DRAW"
is matched. James

Sub SearchAndDestroy()
Const WordToFind = "draw"
Const Col = "a"
Dim k As Long
For k = Cells(65535, Col).End(xlUp).Row To 1 Step -1
If InStr(1, Cells(k, Col), WordToFind, vbTextCompare) 0 _
Then Rows(k).EntireRow.Delete
Next k
End Sub

mikeyVo wrote:
I have a database of thousands of contacts. I would like to delete all
contacts with a certain word. is there a way to search for a word,
then if excel finds the word, delete the row? I have been doing it
manually and it is getting too time consuming
Thanks for your help!


--
mikeyVo
------------------------------------------------------------------------
mikeyVo's Profile: http://www.excelforum.com/member.php...o&userid=34277
View this thread: http://www.excelforum.com/showthread...hreadid=567090