I am trying to remove all named ranges/defined names in my workbook.
I was pretty sure that it would be simple.
I am using the following code:
However, I get an error message:
I have reviewed all the named ranges and none of them appear to fall into those reasons.
A majority of my named ranges use index in the name so that they are dynamic ranges; but I doubt that would be the issue.
Any suggestions or ideas as to why I would be getting this issue? I am racking my brain but can't seem to get it.
-Spydey
I was pretty sure that it would be simple.
I am using the following code:
Code:
Sub DeleteNames()
Dim xn As Name
For Each xn In Application.ActiveWorkbook.Names
xn.Delete
Next
End Sub
However, I get an error message:
Run-time error '1004':
The name that you entered is not valid.
Reasons for this can include:
-The name does not begin with a letter or an underscore
-The name contains a space or other invalid characters
-The name conflicts with an Excel built0in name or the name of another object in the workbook
I have reviewed all the named ranges and none of them appear to fall into those reasons.
A majority of my named ranges use index in the name so that they are dynamic ranges; but I doubt that would be the issue.
Any suggestions or ideas as to why I would be getting this issue? I am racking my brain but can't seem to get it.
-Spydey