Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search not found
Look at the Find Method example in the VBA help. You need to add an
Else clause to the If statement. The above code I gave isn't complete, but should give you some clues of how to fit your requirements into the example. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
search a row for a word and if found | Excel Worksheet Functions | |||
Found Cell Highlighting after Search | Excel Discussion (Misc queries) | |||
search function without error if not found | Excel Programming | |||
Return text found in a search | Excel Worksheet Functions | |||
The search key was not found error | New Users to Excel |