Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 *** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
deleting names from the name box | Excel Discussion (Misc queries) | |||
Deleting unused Defined Names in a workbook? | Excel Programming | |||
Deleting Names | Excel Programming | |||
Deleting workbook names w/ VB | Excel Programming | |||
deleting workbook names in excel | Excel Programming |