rename worksheet based on contents of a cell in different workshee

G

Guest

I have three worksheets within a workbook. The three worksheets are named

"Account Info"
"sep 27,2006"
"lists"

I would like to automatically rename the second worksheet "sep 27, 2006"
based on the contents of cell B6 in the "Account Info" worksheet. The
contents of B6 will be a date in the above format.

The workbook is a template.

How do I do that? I figure I need to right-click the worksheet tab and
enter vba code into the Visual Basic Editor but what is the code?

Can I copy and paste the code or is that not possible?
 
G

Guest

try this
Sub RenameSheet()
Worksheets(2).Name = _
Format(Worksheets("Account Info").Range("B6"), _
"[$-409]mmm dd,yyyy;@")
End Sub
 

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

Top