nameing a worksheet

L

Lost

Is it possible to name a sheet based on 2 cell values with either a formula
or VB?

Example
A1=4/20/09
B2=Help

worksheet name is Help 4/20/09
 
J

Jacob Skaria

"/" is not an accepted character for sheet names. So you need to change that
to something else. I have used Format() function to have the date in a
different format. Try the below code from Immediate window and see. Launch
VBE using Alt+F11 and Ctrl+G to view the immediate window

A1=4/20/09
B2=Help

Activesheet.name = Range("A2") & " " & Format(Range("A1"),"mm-dd-yyyy")

If this post helps click Yes
 
J

Jacob Skaria

You can also refer the sheet using the Sheet name or the Sheet index number.

Sheets("Sheet1").Name = "<New Name>"
Sheets(1).Name = "<New Name>"

If this post helps click Yes
 

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