#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Naming Tabs

Is there any way to force the tab name to be a cell in the worksheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Naming Tabs

Right click on the tab and paste this code in. Change cell reference as
needed. I would probably name the cell then change Range("A1") to
Range("TabName") where "TabName" is the name of the cell. Invalid sheet
names are ignored.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Me.Name = Range("A1").Value
End Sub

"ebro" wrote:

Is there any way to force the tab name to be a cell in the worksheet?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Naming Tabs

So I need to right click and select "View Code"? Then paste the new code?

"JMB" wrote:

Right click on the tab and paste this code in. Change cell reference as
needed. I would probably name the cell then change Range("A1") to
Range("TabName") where "TabName" is the name of the cell. Invalid sheet
names are ignored.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Me.Name = Range("A1").Value
End Sub

"ebro" wrote:

Is there any way to force the tab name to be a cell in the worksheet?

  #4   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Naming Tabs

Yes, I forgot that step. It is an event macro that will fire when the sheet
changes. You won't be able to change the sheet name w/o using VBA.

The reason for naming the cell (post back if you're unfamiliar w/naming
cells in Excel) is so that if it moves (by inserting/deleting rows or
columns, cutting/pasting, etc), VBA will still be able to find it. If you
use a cell reference in VBA (such as A1), it will always refer to A1, even if
the contents of A1 is moved to another cell.


"ebro" wrote:

So I need to right click and select "View Code"? Then paste the new code?

"JMB" wrote:

Right click on the tab and paste this code in. Change cell reference as
needed. I would probably name the cell then change Range("A1") to
Range("TabName") where "TabName" is the name of the cell. Invalid sheet
names are ignored.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Me.Name = Range("A1").Value
End Sub

"ebro" wrote:

Is there any way to force the tab name to be a cell in the worksheet?

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
naming tabs Jeff Excel Worksheet Functions 8 February 6th 06 04:41 AM
How can I automate the naming of worksheet tabs? TJ Excel Discussion (Misc queries) 7 September 8th 05 12:01 AM
Hidding Tabs Aviator Excel Discussion (Misc queries) 1 December 15th 04 04:55 PM
Sheet tabs disappear sometimes in Internet Explorer Jan Nordgreen Excel Discussion (Misc queries) 0 December 6th 04 01:34 AM
Naming Sheets Tabs Cgbilliar Excel Worksheet Functions 2 November 5th 04 05:21 PM


All times are GMT +1. The time now is 01:22 PM.

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

About Us

"It's about Microsoft Excel"