ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   changing sheet names (https://www.excelbanter.com/excel-programming/279365-changing-sheet-names.html)

Andy Healey

changing sheet names
 
Hi all

I have a list of names in a range "A2:A65" on a sheet called ops names.

In the same workbook I have a sheet for each different name, (sheets2 to 65)
What I would like to do is to rename the sheets with the names in the range.

So the name in cell A2 becomes the sheet name of sheet 2, and so on and so
on.

The spreadsheet is used for time sheets, but the staff are not always the
same each month, hence the reason the change sheet names.

Any help greatly appreciated.


best regards

Andy



Bob Phillips[_5_]

changing sheet names
 
Andy,

Simple loop required

For i = 2 To ActiveWorkbook.Worksheets.Count
Worksheets(i).Name = Worksheets("ops names").Cells(i, "A").Value
Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Andy Healey" wrote in message
...
Hi all

I have a list of names in a range "A2:A65" on a sheet called ops names.

In the same workbook I have a sheet for each different name, (sheets2 to

65)
What I would like to do is to rename the sheets with the names in the

range.

So the name in cell A2 becomes the sheet name of sheet 2, and so on and so
on.

The spreadsheet is used for time sheets, but the staff are not always the
same each month, hence the reason the change sheet names.

Any help greatly appreciated.


best regards

Andy





Ron de Bruin

changing sheet names
 
Hi Andy

Try this with the sheet names as first

Sub test()
For a = 2 To ThisWorkbook.Sheets.Count
On Error Resume Next
Sheets(a).Name = Sheets("names").Cells(a, "A").Value
On Error GoTo 0
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Andy Healey" wrote in message ...
Hi all

I have a list of names in a range "A2:A65" on a sheet called ops names.

In the same workbook I have a sheet for each different name, (sheets2 to 65)
What I would like to do is to rename the sheets with the names in the range.

So the name in cell A2 becomes the sheet name of sheet 2, and so on and so
on.

The spreadsheet is used for time sheets, but the staff are not always the
same each month, hence the reason the change sheet names.

Any help greatly appreciated.


best regards

Andy






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

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