I have a number of range names that I would like to automatically rename
I have;
a range containing the list of the old names
a range containing the list of the desired new names
I started something along the lines of the below, but can not get it to work.
Thank you!
First and Best answer gets $25 donation to non-denominational charity of your choice (if approved)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Sub Rename_names()
Dim N As Name
Dim X As Integer
Const Range_from = "oldnamed_Range"
Const Range_toto = "newnamed_Range"
Dim oldname As String
Dim newname As String
For X = 1 To Range(Range_from).Rows.Count
oldname = Range(Range_from).Cells(X).Value
newname = Range(Range_toto).Cells(X).Value
N = oldname ‘ PROBLEM IS THAT NAME DOES NOT LIKE A
N.RefersToLocal
‘Need to 1. assign new name to old refers to
2. replace all references to oldname in spreadsheet with newname
N.Delete
Next X
Exit sub
I have;
a range containing the list of the old names
a range containing the list of the desired new names
I started something along the lines of the below, but can not get it to work.
Thank you!
First and Best answer gets $25 donation to non-denominational charity of your choice (if approved)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Sub Rename_names()
Dim N As Name
Dim X As Integer
Const Range_from = "oldnamed_Range"
Const Range_toto = "newnamed_Range"
Dim oldname As String
Dim newname As String
For X = 1 To Range(Range_from).Rows.Count
oldname = Range(Range_from).Cells(X).Value
newname = Range(Range_toto).Cells(X).Value
N = oldname ‘ PROBLEM IS THAT NAME DOES NOT LIKE A
N.RefersToLocal
‘Need to 1. assign new name to old refers to
2. replace all references to oldname in spreadsheet with newname
N.Delete
Next X
Exit sub