If you're developing a workbook (a one time thing), you may want to use Jan
Karel Pieterse's (with Charles Williams and Matthew Henson) Name Manager:
You can find it at:
NameManager.Zip from
http://www.oaltd.co.uk/mvp
Heck, if you use names, this will make you're life easier.
Bill wrote:
Hello,
I use names a lot in a workbook. When a worksheet is deleted, the names
remain. I would like to delete those that are valid. My thought was to
cycle through the names and try to go to the name. If an error is
caused, then delete the name. I used the code below but every name is
deleted. What am I doing wrong or is there an easier way to do this.
Thanks
Bill
Sub RemoveNamesNotThere()
nm = ActiveWorkbook.Names.Count
On Error GoTo 0
For j = nm To 1 Step -1
On Error Resume Next
NN = ActiveWorkbook.Names(j)
Application.Goto Reference:=NN
If Err < 0 Then
ActiveWorkbook.Names(j).Delete
End If
On Error GoTo 0
Next j
CS.Activate
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
--
Dave Peterson