![]() |
If search criteria is not found, then goto Repeat?
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 |
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 |
If search criteria is not found, then goto Repeat?
Thanks!
"Frank Kabel" wrote in message ... 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 |
All times are GMT +1. The time now is 10:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com