davesweep
Well-known Member
- Joined
- Apr 30, 2007
- Messages
- 510
Hi All,
I am trying to use a little code to delete named ranges from a workbook.
However, on running the code, I get the dreaded runtime error 1004 telling me the name I have entered is invalid. None of the named ranges are deleted. By putting a break in at line 4, print nName.name returns _xlfn.IFERROR and hovering over the nName variable shows "=#NAME?", yet none of the named ranges contain an IFERROR function.
I fear this might be a result of Mondayitis, but I am truly stumped.
I am trying to use a little code to delete named ranges from a workbook.
Code:
Sub DeleteAllNames()
Dim nName As Name
For Each nName In ActiveWorkbook.Names
nName.Delete
Next nName
End Sub
However, on running the code, I get the dreaded runtime error 1004 telling me the name I have entered is invalid. None of the named ranges are deleted. By putting a break in at line 4, print nName.name returns _xlfn.IFERROR and hovering over the nName variable shows "=#NAME?", yet none of the named ranges contain an IFERROR function.
I fear this might be a result of Mondayitis, but I am truly stumped.