Name Object and the Names Collection Example

Sub DeleteInvalidNames()

Dim oName As Name

'Loop through all the names in the active workbook

For Each oName In ActiveWorkbook.Names

'Is it an invalid name?

If InStr(1, oName.RefersTo, "#REF") > 0 Then

'Yes, so log it

Debug.Print "Deleted name " & oName.Name & " -

" & oName.RefersToLocal

'and delete it from the collection

oName.Delete

End If

Next

End Sub

Was this article helpful?

0 0
The Accidental Blogging Millionaires

The Accidental Blogging Millionaires

Get Inspired By The Most Popular Bloggers Online! If You Want To Skyrocket Your Success With Business And Improve Your Overall Life You Need To Have A Look At The Accidental Blogging Millionaires! Business can be a fight, particularly when you’re trying to establish one online and like all fights, to succeed you must find the winning techniques and apply them.

Get My Free Ebook


Post a comment