View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kenrose08[_6_] kenrose08[_6_] is offline
external usenet poster
 
Posts: 1
Default Search not found


Hello!
i entered an item to search in textbox1 and mis encoded it,
and then an error msg appear.
I wan't a msgbox to appear everytime the search failed.

here's the code i'm using:

Private Sub Search_Click()
Set searchRng = Sheets(1).Range("A:A")
With searchRng
Set resultrng = .Find(TextBox1.Text, LookIn:=xlValues)
ComboBox1.Text = ComboBox1.Text & Sheets(1).Range("B" &
_resultrng.Row).Value
End With
End Sub

How do i code it, so that the error msg will be replaced by a msg box
saying "Search Failed". ?

Thanks!


--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=571124