View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Display "Does not exist" upon search no results

Give this a try...

Public Sub SearchList()
Dim wks As Worksheet
Dim rngCurrent As Range
Dim rngToSearch As Range

Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Range("A1", "A100")

Set rngCurrent = rngToSearch.Find("This")
If rngCurrent Is Nothing Then
MsgBox "Not Found"
Else
MsgBox rngCurrent.Address
End If

End Sub
--
HTH...

Jim Thomlinson


"Jean-Jerome Doucet via OfficeKB.com" wrote:

Hi,

I'd like my search looping in VBA to display a message that says that the
identification written does not exist in the list. It must be something like
"On Error GoTo MsgBox" To I imagine. But I don't know hw to write it.
Thx

JJD

--
Message posted via http://www.officekb.com