Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a MAcro that uses a the find ~Find function~. My
problem is when the macro can not find the word any further it crashes instead of exiting the loop. I assume (And we all know what that stands for)it is because of the Microsoft error message of no matches were found. How can I bypass this to exit the loop and continue on? Any help is well recieved. Pete W |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Test for the condition that causes the crash and put in defensive code that
handles the situation. Beyond that, put up the appropriate code snippet and maybe someone can sugges how to do the above. -- Regards, Tom Ogilvy "Pete" wrote in message ... I have a MAcro that uses a the find ~Find function~. My problem is when the macro can not find the word any further it crashes instead of exiting the loop. I assume (And we all know what that stands for)it is because of the Microsoft error message of no matches were found. How can I bypass this to exit the loop and continue on? Any help is well recieved. Pete W |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The error states ~Run-Time Error 91 - Object Varible or
With Block Varible not set.~ Sub Find() Page = "Page" Do Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate ActiveCell.Rows("1:11").EntireRow.Select Selection.Delete Shift:=xlUp ActiveCell.Offset(-6, 0).Range("A1").Select Loop Until Page = "" End Sub Pete W -----Original Message----- Test for the condition that causes the crash and put in defensive code that handles the situation. Beyond that, put up the appropriate code snippet and maybe someone can sugges how to do the above. -- Regards, Tom Ogilvy "Pete" wrote in message ... I have a MAcro that uses a the find ~Find function~. My problem is when the macro can not find the word any further it crashes instead of exiting the loop. I assume (And we all know what that stands for)it is because of the Microsoft error message of no matches were found. How can I bypass this to exit the loop and continue on? Any help is well recieved. Pete W . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with using a Macro Loop | Excel Discussion (Misc queries) | |||
loop a macro | Excel Discussion (Misc queries) | |||
how to put a loop in a macro? | New Users to Excel | |||
macro loop | Excel Discussion (Misc queries) |