ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Rename Multiple Sheets (https://www.excelbanter.com/excel-programming/287364-macro-rename-multiple-sheets.html)

alan

Macro to Rename Multiple Sheets
 
Is there a way to create a macro that will rename one
sheet in a workbook, go to the next sheet, rename that
sheet and continue to the last sheet in the workbook? I
want the sheet name to match the formated date output of a
cell on each respective sheet. I want to copy the
formated date displayed in cell G3, paste it as the sheet
name and then have the macro move to the next sheet and do
the same thing using cell G3 on that sheet. I have done
this manually with the date format being 01-Jan-04 which
is fine. I have 52 sheets, one for each week of the year
and doing this manually is time consuming.

Bob Phillips[_6_]

Macro to Rename Multiple Sheets
 
Alan,

Here's some code

For i = 1 To Worksheets.Count
Worksheets(i).Name = Format(Worksheets(i).Range("G3").Value,
"dd-mmm-yy")
Next i

--

HTH

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

"Alan" wrote in message
...
Is there a way to create a macro that will rename one
sheet in a workbook, go to the next sheet, rename that
sheet and continue to the last sheet in the workbook? I
want the sheet name to match the formated date output of a
cell on each respective sheet. I want to copy the
formated date displayed in cell G3, paste it as the sheet
name and then have the macro move to the next sheet and do
the same thing using cell G3 on that sheet. I have done
this manually with the date format being 01-Jan-04 which
is fine. I have 52 sheets, one for each week of the year
and doing this manually is time consuming.





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

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