View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jimbo213 Jimbo213 is offline
external usenet poster
 
Posts: 30
Default 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