Automatically name all Sheet Tabs from a list

A

aussiegirlone

Can Someone help with this formula
This formula below will rename sheet tabs by coping the data from column A
What I would like it to do is to skip the header row A1 and then rename the
sheets starting from A2. Can this be done?

Sub NameSheets()

For sh = 1 To 15
Sheets(sh + 2).Name = Range("A" & sh).Value
Next sh

End Sub
 
J

Jacob Skaria

The below will rename 2nd sheet onwards from Range A2-A16.

Sub NameSheets()

For sh = 1 To 15
Activeworkbook.Sheets(sh + 2).Name = Range("A" & sh+1)
Next sh

End Sub

If this post helps click Yes
 
A

aussiegirlone

Yes thats works beautifully

Jacob Skaria said:
The below will rename 2nd sheet onwards from Range A2-A16.

Sub NameSheets()

For sh = 1 To 15
Activeworkbook.Sheets(sh + 2).Name = Range("A" & sh+1)
Next sh

End Sub

If this post helps click Yes
 
A

aussiegirlone

It works beautifully
Thankyou very much.

Jacob Skaria said:
The below will rename 2nd sheet onwards from Range A2-A16.

Sub NameSheets()

For sh = 1 To 15
Activeworkbook.Sheets(sh + 2).Name = Range("A" & sh+1)
Next sh

End Sub

If this post helps click Yes
 
J

Jimbo213

Jacob - I had trouble w/ your code.

When I run your exact code on Excel 2007 I get "Run-Time error '9':
Subscript out of range.

I am a real rookie on this VBA code.
I also need to change the fixed-value of 15 to be the last column# in row 1
I use this code to find the last column number with data in row 1

' Holds last column number
' Range("A1").Select
' Range(Selection, Selection.End(xlToRight)).Select
' Selection.End(xlToRight).Select
' LastCol = ActiveCell.Column

I'd appreciate your help to insert worksheets with the names in A2:LastCol
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top