I would greatly appreciate any help as I am totally stuck.
When I delete a Range (i.e. column) with named cells the names are not deleted.
I am trying to write a code to delete leftovers. So far I have:
Sub CleanUp()
For Each Name In ThisWorkbook.Names
If Name = "*!REF!" Then
'Name.Delete
Debug.Print Name
End If
Next
End Sub
I use the Immediate window to check if I get any hits and "Names manager" to confirm that there should be.
I have no idea what is wrong, as following works:
For Each Name In ThisWorkbook.Names
Debug.Print Name
Next
as well as:
For Each Name In ThisWorkbook.Names
If Name = "=Sheet1!#REF!" Then
Name.Delete
End If
Next
Bookmarks