ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatically name all Sheet Tabs from a list (https://www.excelbanter.com/excel-discussion-misc-queries/234506-automatically-name-all-sheet-tabs-list.html)

aussiegirlone

Automatically name all Sheet Tabs from a list
 
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


Jacob Skaria

Automatically name all Sheet Tabs from a list
 
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
---------------
Jacob Skaria


"aussiegirlone" wrote:

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


aussiegirlone

Automatically name all Sheet Tabs from a list
 
Yes thats works beautifully

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"aussiegirlone" wrote:

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


aussiegirlone

Automatically name all Sheet Tabs from a list
 
It works beautifully
Thankyou very much.

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"aussiegirlone" wrote:

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


Jimbo213

Automatically name all Sheet Tabs from a list
 

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

--
Thanks for your reply & assistance.
Jimbo213


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"aussiegirlone" wrote:

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



All times are GMT +1. The time now is 04:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com