ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rename worksheet (https://www.excelbanter.com/excel-programming/307096-rename-worksheet.html)

Donald Duck

Rename worksheet
 
Hi

I need to create a macro that renames each worksheet to the contents in cell
A1 of each worksheet.

Any suggestions will be welcome.

Thanks



nathan

Rename worksheet
 

-----Original Message-----
Hi

I need to create a macro that renames each worksheet to

the contents in cell
A1 of each worksheet.

Any suggestions will be welcome.

Thanks

Try this, i havent tested it myself.
.
For each ws in activeworkbook

ws.name= ws.range("a1")
next ws

Tom Ogilvy

Rename worksheet
 
That should be

Dim ws as Worksheet
For each ws in activeworkbook.worksheets
ws.name= ws.range("a1").value
next ws

--
Regards,
Tom Ogilvy

"nathan" wrote in message
...

-----Original Message-----
Hi

I need to create a macro that renames each worksheet to

the contents in cell
A1 of each worksheet.

Any suggestions will be welcome.

Thanks

Try this, i havent tested it myself.
.
For each ws in activeworkbook

ws.name= ws.range("a1")
next ws




Donald Duck

Rename worksheet
 
Perfect!

Works a treat

Thanks.


"Tom Ogilvy" wrote in message
...
That should be

Dim ws as Worksheet
For each ws in activeworkbook.worksheets
ws.name= ws.range("a1").value
next ws

--
Regards,
Tom Ogilvy

"nathan" wrote in message
...

-----Original Message-----
Hi

I need to create a macro that renames each worksheet to

the contents in cell
A1 of each worksheet.

Any suggestions will be welcome.

Thanks

Try this, i havent tested it myself.
.
For each ws in activeworkbook

ws.name= ws.range("a1")
next ws







All times are GMT +1. The time now is 08:27 AM.

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