Article ID: 119826
Article Last Modified on 1/19/2007
' Module to remove all hidden names on active workbook
Sub Remove_Hidden_Names()
' Dimension variables.
Dim xName As Variant
Dim Result As Variant
Dim Vis As Variant
' Loop once for each name in the workbook.
For Each xName In ActiveWorkbook.Names
'If a name is not visible (it is hidden)...
If xName.Visible = True Then
Vis = "Visible"
Else
Vis = "Hidden"
End If
' ...ask whether or not to delete the name.
Result = MsgBox(prompt:="Delete " & Vis & " Name " & _
Chr(10) & xName.Name & "?" & Chr(10) & _
"Which refers to: " & Chr(10) & xName.RefersTo, _
Buttons:=vbYesNo)
' If the result is true, then delete the name.
If Result = vbYes Then xName.Delete
' Loop to the next name.
Next xName
End Sub
Note If your sheet names contain spaces, you may receive an error when
you attempt to delete the defined name. 188446 FIX: AFC Deadlock May Occur When Setting UIFrame's Cursor
Additional query words: 97 98 XL98 XL97 XL7 XL5 remove hidden define names kbhowto how to XL
Keywords: kbdtacode kbhowto kbprogramming KB119826