#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default tab naming

is there anyway to have either

1) a cell drive the naming of a worksheet

or

2) a worksheet drive the naming of a cell?

thanks.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 341
Default tab naming

1) yes, with sheet level code like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then ActiveSheet.Name = Range("a1").Value
End Sub

2) yes, with
=MID(CELL("Filename"),FIND("]",CELL("Filename"))+1,255)
this only works on a workbook that has been saved.

--
Allllen


" wrote:

is there anyway to have either

1) a cell drive the naming of a worksheet

or

2) a worksheet drive the naming of a cell?

thanks.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default tab naming

second suggestion worked like a charm. thanks!

-brian

Allllen wrote:
1) yes, with sheet level code like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then ActiveSheet.Name = Range("a1").Value
End Sub

2) yes, with
=MID(CELL("Filename"),FIND("]",CELL("Filename"))+1,255)
this only works on a workbook that has been saved.

--
Allllen


" wrote:

is there anyway to have either

1) a cell drive the naming of a worksheet

or

2) a worksheet drive the naming of a cell?

thanks.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default tab naming

"Allllen" wrote in message

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then ActiveSheet.Name = Range("a1").Value
End Sub


I'd be careful with that one. Since the Change event occurs when a cell is
changed by VBA, it is possible that cell A1 on Sheet1 would be changed when
Sheet2 is active. Thus, your code would rename Sheet2, not Sheet1, with the
value in A1 on Sheet1.

Instead, just to be safe, use

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then Me.Name = Range("a1").Value
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Allllen" wrote in message
...
1) yes, with sheet level code like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then ActiveSheet.Name = Range("a1").Value
End Sub

2) yes, with
=MID(CELL("Filename"),FIND("]",CELL("Filename"))+1,255)
this only works on a workbook that has been saved.

--
Allllen


" wrote:

is there anyway to have either

1) a cell drive the naming of a worksheet

or

2) a worksheet drive the naming of a cell?

thanks.




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
intersection naming transport between files BorisS Excel Discussion (Misc queries) 0 June 29th 06 08:37 PM
Pivot Table Group Naming Arun Excel Discussion (Misc queries) 3 June 26th 06 10:58 PM
automate the tab naming philtyler Excel Discussion (Misc queries) 1 May 10th 06 06:44 PM
How can I automate the naming of worksheet tabs? TJ Excel Discussion (Misc queries) 7 September 8th 05 12:01 AM
Naming ranges? pmw5 Excel Discussion (Misc queries) 2 March 4th 05 06:57 PM


All times are GMT +1. The time now is 05: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"