View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default If search criteria is not found, then goto Repeat?

Hi Paul
try
Dim rng as range
on error resume next
set rng = Selection.Find(What:=model, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False)
on error goto 0
if not rng is nothing then
rng.select
end if




--
Regards
Frank Kabel
Frankfurt, Germany

PCLIVE wrote:
I'm using a macro to search for an item. If the item is not found,
then I receive an error. How can I tell the macro to goto Repeat: if
the search criteria is not found?

This is my search code.

Selection.Find(What:=model, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False).Select

Thanks,
Paul