Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a Range Name
Hi,
The code below when finding the Range Name and when the name is exists on the sheet it runs ok but when it does not find the Range Name ("Stop") it blows up with a run time error that reads 'Global Method Failed' Can someone help and show me what is wrong or the proper way to code this. If Not Range(Range("D101"), Range("D65536")) _ .Find(Range("Stop")) Is Nothing Then GoTo NextStep (MyCode) Exit Sub NextStep: (MyCode) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a Range Name
You just need an error-handling event in the code. This On Error will trigger the procedure to end Sub ProcedureName On Error Goto MyErrorHandler // your code here // Exit Sub MyErrorHandler: End Su -- crispb ----------------------------------------------------------------------- crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088 View this thread: http://www.excelforum.com/showthread.php?threadid=27419 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a Range Name
Dim rng as Range, rng1 as Range
on Error Resume next set rng = Range("Stop") on Error goto 0 if not rng is nothing then set rng1 = Range("D101:D65536") _ .Find(rng.Value) if not rng1 is nothing then ' now you can run your code and ' use rng1 if you need to end if end if Next Step: Not sure what action should be taken if Range("Stop") is not found, but the above portion of code won't blow up. -- Regards, Tom Ogilvy "James Montgomery" wrote in message ... Hi, The code below when finding the Range Name and when the name is exists on the sheet it runs ok but when it does not find the Range Name ("Stop") it blows up with a run time error that reads 'Global Method Failed' Can someone help and show me what is wrong or the proper way to code this. If Not Range(Range("D101"), Range("D65536")) _ .Find(Range("Stop")) Is Nothing Then GoTo NextStep (MyCode) Exit Sub NextStep: (MyCode) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a Range Name
Thanks for all help
James "James Montgomery" wrote in message ... Hi, The code below when finding the Range Name and when the name is exists on the sheet it runs ok but when it does not find the Range Name ("Stop") it blows up with a run time error that reads 'Global Method Failed' Can someone help and show me what is wrong or the proper way to code this. If Not Range(Range("D101"), Range("D65536")) _ .Find(Range("Stop")) Is Nothing Then GoTo NextStep (MyCode) Exit Sub NextStep: (MyCode) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding the corresponding value in a range? | Excel Worksheet Functions | |||
Finding a value associated with a range | Excel Worksheet Functions | |||
finding name within range | Excel Worksheet Functions | |||
finding if name within range | Excel Worksheet Functions | |||
Finding from a range | Excel Programming |