Change multiple named cells and ranges in a worksheet at the same time

I want to change many excell names in a sheet (200+), the names are like comp .... and I want to change it in cons ..... So this change is the same every time. Is there a way to do this all at once?

I know for functions it is simple with h control and then replace comp with cons and then they all change at once. You also know if it's possible for names (so cell names and cell range). This saves me a lot of (especially boring) work. Thank you so much!

Best Timothy

+3


source to share


1 answer


If you know How to use Excel macro ,

Sub RangeRename()
 Dim N As Name
    For Each N In ActiveWorkbook.Names
        N.Name = WorksheetFunction.Substitute(N.Name, "comp", "cons")
    Next N
End Sub

      



If not

  • Hit Alt+F11

  • Paste the code above
  • Hit F5

    Run

+1


source







All Articles