Sub Test()
Dim Nm As Name
For Each Nm In ThisWorkbook.Names
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "LgLO", "SST")
Next Nm
End Sub
Sub Test()
Dim Nm As Name
For Each Nm In ThisWorkbook.Names
If Nm.Name Like "*LgLO*" Then
Names.Add WorksheetFunction.Substitute(Nm.Name, "LgLO", "SST"), Nm.RefersTo
End If
Next Nm
End Sub
Sub DLTNM()
Dim Nm As Name
For Each Nm In ThisWorkbook.Names
If Nm.Name Like "*LgLO*" Then
Nm.Delete
End If
Next Nm
End Sub
I need to rename a bunch of named ranges, replacing certain parts of the names with other, given parts. For example, I need to rename all of the names that contain LgLO, replacing LgLO with SST. Is there a macro that I can use???
Sub Test1()
Dim Nm As Name
For Each Nm In ThisWorkbook.Names
If Nm.Name Like "aaaa_*" Then
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "aaaa", "bb")
End If
Next Nm
End Sub
Sub Test2()
Dim Nm As Name
For Each Nm In ThisWorkbook.Names
Select Case Nm.Name
Case "Test_1"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_1", "Test_1A")
Case "Test_2"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_2", "Test_1B")
Case "Test_3"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_3", "Test_1C")
Case "Test_4"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_4", "Test_1D")
Case "Test_5"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_5", "Test_1E")
Case "Test_6"
Nm.Name = WorksheetFunction.Substitute(Nm.Name, "Test_6", "Test_1F")
End Select
Next Nm
End Sub