Unable to delete Named Range with #NAME?
How do I add to my VBA to delete this?
I have created the below code, it deletes all the named ranges in my workbook except for one, details are:
Name: _xlfn.IFERROR Value: #NAME? Refers To: =#NAME?
'Delete All Named Ranges
Dim xName As Name
On Error Resume Next
For Each xName In ActiveWorkbook.Names
xName.Visible = True
If InStr(1, xName.RefersTo, "=#NAME?") > 0 Then xName.Delete
If InStr(1, xName.RefersTo, "#REF!") > 0 Then xName.Delete
If InStr(xName.Value, "#REF!") > 0 Then xName.Delete
xName.Delete
Next xName
On Error GoTo 0
End Sub```