Deleting broken range names

R

Ray Kanner

I have a lot of range names in my workbook. After some
time, some of them no longer point anywhere, and I'd like
to delete them. I cannot do this manually since the broken
range names do not show up under Insert/Name/Define. I
would like to write a simple loop that works as follows:
For Each nm In ActiveWorkbook.Names
<If nm is broken then delete nm>
Next
Can someone please help me fill in the missing line.

Thanks in advance

Ray Kanner
(e-mail address removed)
 
T

Tom Ogilvy

For Each nm In ActiveWorkbook.Names
if instr(nm.Refersto,"#") then
nm.Delete
end if
Next
 

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