Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Testing in a macro for bad range name?

I'm working on a project that opens each old workbook in a folder and
extracts data. Some of these workbooks have bad range names, e.g. with #REF
as part of the refers to. A test against the list of workbook range names
passes. You can't test for iserror, as you can't even read it. Setting an
On Error GoTo xxx doesn't kick in for some strange reason. How can I test
for the invalid range name and branch accordingly?

Don <donwiss at panix.com.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Testing in a macro for bad range name?

Try this:

Dim nm as Name
for each nm in Activeworkbook.Names
if instr(1,nm.Refersto,"#REF",vbTextCompare) then
msgbox nm.name & " " & nm.Refersto
end if
Next

Untested.
--
Regards,
Tom Ogilvy

"Don Wiss" wrote in message
...
I'm working on a project that opens each old workbook in a folder and
extracts data. Some of these workbooks have bad range names, e.g. with

#REF
as part of the refers to. A test against the list of workbook range names
passes. You can't test for iserror, as you can't even read it. Setting an
On Error GoTo xxx doesn't kick in for some strange reason. How can I test
for the invalid range name and branch accordingly?

Don <donwiss at panix.com.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TESTING A RANGE OF CELLS Richard[_2_] New Users to Excel 3 April 1st 07 02:52 PM
TESTING A RANGE OF CELLS Richard[_2_] Excel Worksheet Functions 3 April 1st 07 02:52 PM
Testing a person's age to be within a range MH Excel Worksheet Functions 10 December 31st 06 10:04 PM
Testing for content in Range Jim McLeod[_3_] Excel Programming 1 July 13th 04 05:58 PM
Testing for existence of range David Excel Programming 4 November 19th 03 07:39 AM


All times are GMT +1. The time now is 04:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"