Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am using a Range(XX).Find search to find a name in a single column,
and I am trying to build an error handling routine so that different actions will execute depending on whether the query is found. The trouble is that the error routine executes every time regardless of the result of the search. Here is the code: Sub Look_Here1() Dim FoundCell As Range Dim WhatFor As Variant WhatFor = ActiveSheet.Cells(7, 2).Value Set FoundCell = Range("B8:B990").Find(What:=WhatFor, after:=ActiveCell, _ SearchDirection:=xlNext, searchorder:=xlByRows, _ MatchCase:=False) FoundCell.Offset(0, -1).Select ActiveCell.FormulaR1C1 = "X" Selection.Offset(0, 3).Select On Error GoTo NotFound NotFound: Range("a7").Select ActiveCell.FormulaR1C1 = "X" Range("D7").Select End Sub Where have I gone wrong? Any help will be appreciated. mb |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do i build a search table in excel | Excel Worksheet Functions | |||
build a search tool in excel | Excel Discussion (Misc queries) | |||
Search open sheets in workbook and insert into open sheet | Excel Discussion (Misc queries) | |||
Search Entire Workbook | Excel Discussion (Misc queries) | |||
FAQ Spreadsheet with search function | Excel Discussion (Misc queries) |