Rename a Excel worksheet with the text in a cell

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

smarts56

Thread Starter
Joined
Sep 14, 2004
Messages
2
Could someone tell me how to write a macro to rename a Excel worksheet using the text in a cell in the same worksheet.
 
Joined
Sep 4, 2003
Messages
4,912
Just be aware that the sheet name cannot contain some certain characters such as / : * and a few others. Also be aware that the sheet name cannot exceed 31 characters (including spaces)

Here are some various code example of how to achieve what you want


ActiveSheet.Name = Range("A1").Text

Sheets("Sheet1").Name = Range("A1").Text

Sheets(1).Name = Range("A1").Text

Sheets("Sheet1").Name = Activecell.Text <----- If the source cell is selected



Rollin
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

No members online now.
Top