LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Delete defined names with errors using VBA

Using this code snippet from Microsoft (that I modified slightly), I can
delete any and all defined names without errors.
Any defined name that has a #REF! error, for example, cannot be deleted with
the VBA.

Is there any VBA code that will delete defined names with errors?

Thanks!

Mike


Sub DELETE_VISIBLE_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

If Vis = "Visible" Then xName.Delete

' Loop to the next name.
Next xName

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selectively Delete Defined Names Kev Excel Programming 2 October 31st 08 01:55 AM
Delete defined names beata Excel Discussion (Misc queries) 1 January 7th 08 09:44 PM
delete defined names Todd Excel Programming 4 March 6th 06 08:10 PM
How to delete all defined names from a workbook? Dmitry Kopnichev Links and Linking in Excel 15 November 14th 05 03:26 PM
Macro to delete Defined Names Mike Piazza Excel Programming 1 May 13th 05 06:33 PM


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"