View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brian B. Brian B. is offline
external usenet poster
 
Posts: 12
Default Delete All Names - Even Invalid "#REF" Names

FYI: The following code will delete all names in a workbook, including
those with a "#REF" error:

Sub Delete_Names()

Dim NameX As Name
On Error GoTo Nxt
For Each NameX In Names
ActiveWorkbook.Names(NameX.Name).Delete
Nxt:
Next NameX

End Sub

Adding the "On Error GoTo" will allow the code to also delete invalid
names too. I couldn't find this anywhere so I though I'd post it ...

-Brian