Rename worksheet

D

Donald Duck

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
 
N

nathan

-----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
 
T

Tom Ogilvy

That should be

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

Donald Duck

Perfect!

Works a treat

Thanks.


Tom Ogilvy said:
That should be

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