ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   tab names from cell values (https://www.excelbanter.com/excel-discussion-misc-queries/124490-tab-names-cell-values.html)

cursednomore

tab names from cell values
 
I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?

Gary''s Student

tab names from cell values
 
Leave your A2 cells alone.

Enter and run this small macro:

Sub tabnames()
For Each w In Worksheets
w.Activate
w.Name = Format(Range("A2").Value, "m-d-yyyy")
Next
End Sub

Each tab will be re-named to the contents of A2, but formatted as a legal
tabname.
--
Gary''s Student


"cursednomore" wrote:

I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?


CLR

tab names from cell values
 
Maybe this..........

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Range("B7").Value < shname Then
shname = Format(Range("b7").Value, "m_d_yy")
End If
Me.Name = shname
End Sub

Vaya con Dios,
Chuck, CABGx3


"cursednomore" wrote:

I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?


Don Guillett

tab names from cell values
 
This will name the sheet 01-01 if any valid date in cell a1
Sub namesheetfromcell()
ActiveSheet.Name = Format(Range("a1"), "mm-dd")
End Sub

to do for all sheets

for each ws in worksheets
ws.name=Format(ws.Range("a1"), "mm-dd")
next

You could even use Wk1 Wk2 etc by

Sub nameshts()
For i = 1 To 5
Sheets(i).Name = "WK" & i
Next

End Sub
--
Don Guillett
SalesAid Software

"cursednomore" wrote in message
...
I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the
tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?




cursednomore

tab names from cell values
 
Gary's Studaent had it perfect!! Thanks very much!!

"Gary''s Student" wrote:

Leave your A2 cells alone.

Enter and run this small macro:

Sub tabnames()
For Each w In Worksheets
w.Activate
w.Name = Format(Range("A2").Value, "m-d-yyyy")
Next
End Sub

Each tab will be re-named to the contents of A2, but formatted as a legal
tabname.
--
Gary''s Student


"cursednomore" wrote:

I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?


Don Guillett

tab names from cell values
 
Almost. Activation of each sheet is not required.


--
Don Guillett
SalesAid Software

"cursednomore" wrote in message
...
Gary's Studaent had it perfect!! Thanks very much!!

"Gary''s Student" wrote:

Leave your A2 cells alone.

Enter and run this small macro:

Sub tabnames()
For Each w In Worksheets
w.Activate
w.Name = Format(Range("A2").Value, "m-d-yyyy")
Next
End Sub

Each tab will be re-named to the contents of A2, but formatted as a legal
tabname.
--
Gary''s Student


"cursednomore" wrote:

I have 52 worksheets, for each week of the year. In each worksheet, the
beginning date is in A2. I would like to show the beginning date as the
tab
name, but I understand that I can't have a "/" in the tab name. Any
suggestions, without physically renaming each sheet?





All times are GMT +1. The time now is 06:02 AM.

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