View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default How can I get around "Find" if there's nothing to find

Set a range to the cell.find then check if it is nothing like this:
Dim FindCell as Range
Set FindCell = Cells.Find(What:="YourText", After:=Range("A1"),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If FindCell = nothing then
Msgbox "Search String not Found"
Else
'Your Code here
End if

HTH

Die_Another_Day

CarolineHedges wrote:
I need to my macro to be able to Find certain words and delete the rows
wherever these words occur.

If I use the Cells.Find(????) to locate the words, the macro doesn't
work ifthe word to find isn't in the spreadsheet.

How can I get around the Cell.Find(????), ie to ignore and move on to
the net step if there aren't any more of ??? to find.

This is causing me so much frustration!!!

Thanks


--
CarolineHedges
------------------------------------------------------------------------
CarolineHedges's Profile: http://www.excelforum.com/member.php...o&userid=35705
View this thread: http://www.excelforum.com/showthread...hreadid=555574