#1   Report Post  
Posted to microsoft.public.excel.misc
Marcus
 
Posts: n/a
Default Sheet Names

Hello,
Is there a way yo can put a formula in a cell to have it equal what the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it. Each
sheet has a different name. Instead of haveing to name every sheet, and tab
twice is there a way I can rename the tab and have a formula i the sheet that
will name the sheet the same as the tab name?)

  #2   Report Post  
Posted to microsoft.public.excel.misc
Barb Reinhardt
 
Posts: n/a
Default Sheet Names

Try this:
=RIGHT(CELL("filename",A2),LEN(CELL("filename",A2) )-SEARCH("]",CELL("filename",A2)))

Just don't put it in A2 or you'll get a circular reference.

"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what
the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it.
Each
sheet has a different name. Instead of haveing to name every sheet, and
tab
twice is there a way I can rename the tab and have a formula i the sheet
that
will name the sheet the same as the tab name?)



  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Sheet Names

You need VBA to name a sheet after a cell, like this

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = Target.Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what

the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it.

Each
sheet has a different name. Instead of haveing to name every sheet, and

tab
twice is there a way I can rename the tab and have a formula i the sheet

that
will name the sheet the same as the tab name?)



  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Sheet Names

Ignore that, I thought you were asking for code to rename the sheet to the
value in the cell.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...
You need VBA to name a sheet after a cell, like this

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = Target.Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what

the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it.

Each
sheet has a different name. Instead of haveing to name every sheet, and

tab
twice is there a way I can rename the tab and have a formula i the sheet

that
will name the sheet the same as the tab name?)





  #5   Report Post  
Posted to microsoft.public.excel.misc
Marcus
 
Posts: n/a
Default Sheet Names

This worked Barb,
Thank you.

"Barb Reinhardt" wrote:

Try this:
=RIGHT(CELL("filename",A2),LEN(CELL("filename",A2) )-SEARCH("]",CELL("filename",A2)))

Just don't put it in A2 or you'll get a circular reference.

"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what
the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it.
Each
sheet has a different name. Instead of haveing to name every sheet, and
tab
twice is there a way I can rename the tab and have a formula i the sheet
that
will name the sheet the same as the tab name?)






  #6   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie
 
Posts: n/a
Default Sheet Names

Hi Barb,
Good to be on the lookout for circular references, but ...

Actually you won't get a circular reference, because it is not picking
up the value of A2. All that A2 in your reference is going to tell Excel
is the location you are interested in -- worksheet, workbook, pathname etc.
You could use any cell on that sheet and get the same answer.
http://www.mvps.org/dmcritchie/excel/pathname.htm

--
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Barb Reinhardt" wrote in message ...
Try this:
=RIGHT(CELL("filename",A2),LEN(CELL("filename",A2) )-SEARCH("]",CELL("filename",A2)))

Just don't put it in A2 or you'll get a circular reference.

"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what
the
sheet name is? Example( I have a spreadsheet with about 30 sheets in it.
Each
sheet has a different name. Instead of haveing to name every sheet, and
tab
twice is there a way I can rename the tab and have a formula i the sheet
that
will name the sheet the same as the tab name?)





  #7   Report Post  
Posted to microsoft.public.excel.misc
Barb Reinhardt
 
Posts: n/a
Default Sheet Names

David,

I had this equation in A1 to begin with and had A1 in the formula and I got
an error for a circular reference.

Barb
"David McRitchie" wrote in message
...
Hi Barb,
Good to be on the lookout for circular references, but ...

Actually you won't get a circular reference, because it is not picking
up the value of A2. All that A2 in your reference is going to tell Excel
is the location you are interested in -- worksheet, workbook, pathname
etc.
You could use any cell on that sheet and get the same answer.
http://www.mvps.org/dmcritchie/excel/pathname.htm

--
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Barb Reinhardt" wrote in message
...
Try this:
=RIGHT(CELL("filename",A2),LEN(CELL("filename",A2) )-SEARCH("]",CELL("filename",A2)))

Just don't put it in A2 or you'll get a circular reference.

"Marcus" wrote in message
...
Hello,
Is there a way yo can put a formula in a cell to have it equal what
the
sheet name is? Example( I have a spreadsheet with about 30 sheets in
it.
Each
sheet has a different name. Instead of haveing to name every sheet, and
tab
twice is there a way I can rename the tab and have a formula i the
sheet
that
will name the sheet the same as the tab name?)







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing Sheet Names Stuart Grant New Users to Excel 1 October 4th 05 03:43 PM
Putting Sheet Names in a range and renaming it? Steve Excel Worksheet Functions 1 June 1st 05 01:57 AM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta Excel Discussion (Misc queries) 14 March 16th 05 04:41 PM
sheet names Paweł Gałecki Excel Discussion (Misc queries) 2 March 4th 05 01:15 PM
Locking Sheet names in formulas O'C Excel Worksheet Functions 2 December 16th 04 06:31 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"