View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Removing named cells

this may work (not tested)



Sub clearnames()
For Each rangename In ActiveWorkbook.Names
msg = MsgBox("Range Name: " & rangename.Name & Chr(10) & _
" REFERS TO: " & rangename & Chr(10) & Chr(10) & _
" Delete Name?", 36, "Delete Name")
If msg = 6 Then rangename.Delete
Next rangename
End Sub

--
jb


"greg" wrote:

I create and delete lots of cells in one of my excel applications. Each
cell has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks