ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   nameing a worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/228618-nameing-worksheet.html)

Lost

nameing a worksheet
 
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


Jacob Skaria

nameing a worksheet
 
"/" 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
---------------
Jacob Skaria


"Lost" wrote:

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


Jacob Skaria

nameing a worksheet
 
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
---------------
Jacob Skaria


"Lost" wrote:

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



All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com