Thread: Find
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Beach Peter Beach is offline
external usenet poster
 
Posts: 70
Default Find

Hi,

Try:

Dim r As Range
Set r = Selection.Find( . . . .)
if not r is nothing then
do your stuff . . .
End If

HTH

Peter Beach

wrote in message
...
Hello,

I currently use the standard vba code to find specific
cells (data, words) within a spreadsheet.

Selection.Find(What:="NEW1", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

My problem is when the information is not in the
spreadsheet I get an error. How could I rephrase my code
not give me an error if the information is not in the
sheet (in this case the wording "NEW1" is not in the
sheet.)


Thank You,