Use a List of Existing worksheet names and update them based on new list

jamiecobbey

New Member
Joined
May 11, 2018
Messages
1
I have a list of existing worksheet names in A1:A50 (although the worksheets themselves are NOT in that order) and a list of new names I want to update each sheet to in B1:B50. I would like to run a macro that looks for the worksheet name in A1, finds it in the workbook and then renames it to B1 and then continue down the list.

First time posting here - really appreciate any help
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi & welcome to MrExcel.
How about
Code:
Sub ChangeNames()
   Dim Cl As Range
   
   For Each Cl In Sheets("[COLOR=#ff0000]List[/COLOR]").Range("A1:A50")
      If Not IsEmpty(Cl) Then
         If Evaluate("isref('" & Cl.Value & "'!a1)") Then Sheets(Cl.Value).Name = Cl.Offset(, 1).Value
      End If
   Next Cl
End Sub
Change sheet name in red to suit
 
Upvote 0
Run this with the sheet your list is on the active sheet:
Code:
Sub RenameSheets()
Dim V As Variant, i As Long
V = ActiveSheet.Range("A1:B50").Value
Application.ScreenUpdating = False
For i = LBound(V, 1) To UBound(V, 1)
    On Error Resume Next
    Sheets(V(i, 1)).Name = V(i, 2)
    On Error GoTo 0
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,267
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top