how to delete multiple defined names in excel 2003. I came across this macro to do so but it is giving me a run time error. Not sure what is wrong with it. I used a excel spreadsheet from a friend that had a bunch of named cells and I don't know how to remove all of them. Please help
Sub DeleteAllNamesWithREFError()
Dim N As Name
If MsgBox("Are you sure?", vbYesNo + vbDefaultButton2, "Confirm macro") = vbNo Then Exit Sub
For Each N In ActiveWorkbook.Names
If InStr(N.Value, "#REF") Then N.Delete
Next N
End Sub
Sub DeleteAllNamesWithREFError()
Dim N As Name
If MsgBox("Are you sure?", vbYesNo + vbDefaultButton2, "Confirm macro") = vbNo Then Exit Sub
For Each N In ActiveWorkbook.Names
If InStr(N.Value, "#REF") Then N.Delete
Next N
End Sub