Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
The better way to work with Find is to write the code in the following manner: Dim FoundCell As Range Set FoundCell = Cells.Find(....) If FoundCell Is Nothing Then ' code for value not found Else ' code for value found End If -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "John Pierce" wrote in message om... I have this simple program that captures a string and then jumps to another sheet to look for that string. It works most of the but causes an annoying error when "findThis" is not on the target sheet. I have tried various "On Error GoTo . . ." with no success. Sub FindThis() ' Dim FindThis As String FindThis = ActiveCell.Text Sheets("Box Log").Select Cells.Find(What:=FindThis, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate ' End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling | Excel Discussion (Misc queries) | |||
Handling #NUM! error | Excel Worksheet Functions | |||
Error handling in this code | Excel Discussion (Misc queries) | |||
Error Handling | Excel Programming | |||
Error Handling | Excel Programming |