I am working with excel 2010. I am trying to write a script to go through the named ranges of the workbook and delete ones with #REF errors and add ones that don't exist. Currently I am using the Names range but I only get the last part of the range not the whole range so my code does not work. This is my first post to the board.
Code:
For Each nName In Names
'
' strRangeName = "Dwelling_Territory"
'
' If nName = strRangeName Then
' ActiveWorkbook.Names(strRangeName).Delete
' Else
' 'Add Named Range
' ActiveWorkbook.Names.Add Name:=strRangeName, RefersToR1C1:= _
' "=Tables!R4C703"
' End If
'If Named Range does not exist
' If RangeNameExists(strRangeName) = False Then
' If nName <> strRangeName Then
' ActiveWorkbook.Names.Add Name:=strRangeName, RefersToR1C1:= _
' "=Tables!R4C703"
' End If