Test for existence of Name

J

Jack Schitt

Sorry, trivial one:

In a VBA macro I wish to test for the existence of a name local to the
active sheet, preferably without triggering an error state.

Syntax needs to be

If <expression> then exit sub

Where expression is true when the specified name does not exist.

Help? Thanks in advance
 
F

Frank Kabel

Hi
try something like the following

dim rng as range
on error resume next
set rng = activesheet.Range("your_name")
if err.number <>0 then
exit sub
end if
on error goto 0
 
J

Jack Schitt

Thanks Frank

--
Return email address is not as DEEP as it appears
Frank Kabel said:
Hi
try something like the following

dim rng as range
on error resume next
set rng = activesheet.Range("your_name")
if err.number <>0 then
exit sub
end if
on error goto 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top