Deleting broken range names

  • Thread starter Thread starter Ray Kanner
  • Start date Start date
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)
 
For Each nm In ActiveWorkbook.Names
if instr(nm.Refersto,"#") then
nm.Delete
end if
Next
 
Back
Top