ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Auto worksheet name? (https://www.excelbanter.com/excel-worksheet-functions/270888-auto-worksheet-name.html)

Esradekan

Auto worksheet name?
 
On the first sheet (named 'Index') of the workbook in cells B2-B21 I
have a list that changes from year to year. I need to have a
worksheet named from each of the names in the list and need to have
the rest of the worksheets in the book named accordingly. (ie B2 =
Sheet2, B3 = Sheet3 etc etc) Can this be done? and if so, how? Im
using Excel 2010 in a macro enabled book.

Hope someone can help.

TIA

(^-^)<


Gord

Auto worksheet name?
 
Sub NameWS()
'name sheets with list in B2:B21 on first sheet
On Error Resume Next
For i = 2 To Worksheets.Count
Sheets(i).Name = Sheets(1).Cells(i, 2).Value
Next i
End Sub


Gord Dibben Microsoft Excel MVP

On Sun, 7 Aug 2011 02:20:57 -0700 (PDT), Esradekan
wrote:

On the first sheet (named 'Index') of the workbook in cells B2-B21 I
have a list that changes from year to year. I need to have a
worksheet named from each of the names in the list and need to have
the rest of the worksheets in the book named accordingly. (ie B2 =
Sheet2, B3 = Sheet3 etc etc) Can this be done? and if so, how? Im
using Excel 2010 in a macro enabled book.

Hope someone can help.

TIA

(^-^)<



All times are GMT +1. The time now is 09:09 PM.

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