Thread: If Error
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default If Error

Mike,

Try something like

Dim FoundCell As Range
Set FoundCell = Worksheets("Blank 1").Find(What:=AgentName)
If FoundCell Is Nothing Then
Msgbox "Not Found"
Else
MyRow = FoundCell.Row
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Mike" wrote in message
...
Hi.

The following code finds a text string in
worksheet "Blank 1". I need to have a msgbox come-up if
the text is not found. How should I program so that an
error won't throw the user into the module?

myRow = Worksheets("Blank 1").Rows.Find
(What:=AgentName).Row + 1

Thanks,
Mike.