VBA Help: name existing sheets from list

imaguy77

New Member
Joined
Aug 26, 2008
Messages
21
Hi all,

Wondering if I can get some help, shouldn't be too much code but i'm new to VBA.

I have a list of varying length in Sheet1 in column A which I want to be the sheet names of already existing sheets.

How do I rename the sheets in the workbook, starting with the 2nd sheet (don't want to rename Sheet1) according to the list of names?

Thanks!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try

Code:
Sub NameSheets()
Dim i As Long
For i = 2 To Sheets.Count
    On Error Resume Next
    Sheets(i).Name = Sheets(1).Range("A" & i).Value
    On Error GoTo 0
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

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