Rename worksheet

  • Thread starter Thread starter Donald Duck
  • Start date Start date
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
 
-----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
 
That should be

Dim ws as Worksheet
For each ws in activeworkbook.worksheets
ws.name= ws.range("a1").value
next ws
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top