View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Removing named cells


missed a character that may make it safer:

If nm Like "*REF!*" Then
--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
see if this does what you want:

Sub name_ranges2()
Dim nm As Name

Select Case MsgBox("Are you Sure You Want To Delete All Named Ranges (#REF)?",
_
vbOKCancel Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbOK
For Each nm In ThisWorkbook.Names
If nm Like "*REF*" Then
nm.Delete
End If
Next nm
Case vbCancel
Exit Sub
End Select

End Sub

--


Gary


"greg" wrote in message
...
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