Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Worksheet naming with cell info

Can anyone tell me how to link a cell info into the naming of a worksheet.
Normally I just right click on the tab and rename, but we would like a
formula there if possible to read a certain cell which renames the worksheet
when that cell is used.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Worksheet naming with cell info

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
Me.Name = .Value
End If
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

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"HFM - LEE" <HFM - wrote in message
...
Can anyone tell me how to link a cell info into the naming of a worksheet.
Normally I just right click on the tab and rename, but we would like a
formula there if possible to read a certain cell which renames the
worksheet
when that cell is used.



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

I right clicked then hit view code and then pasted the code from Private
Sub...End Sub. I then changed H1 to D6(the cell I need), but the tab name
did not change. If that cell is a Vlookup cell, would that matter?

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
Me.Name = .Value
End If
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

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"HFM - LEE" <HFM - wrote in message
...
Can anyone tell me how to link a cell info into the naming of a worksheet.
Normally I just right click on the tab and rename, but we would like a
formula there if possible to read a certain cell which renames the
worksheet
when that cell is used.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Worksheet naming with cell info

Yes it does. Try this instead

Private Sub Worksheet_Calculate()
With Me.Range("H1")
If .Value < "" Then
Me.Name = .Value
End If
End With
End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"HFM - LEE" wrote in message
...
I right clicked then hit view code and then pasted the code from Private
Sub...End Sub. I then changed H1 to D6(the cell I need), but the tab name
did not change. If that cell is a Vlookup cell, would that matter?

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value < "" Then
Me.Name = .Value
End If
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

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"HFM - LEE" <HFM - wrote in message
...
Can anyone tell me how to link a cell info into the naming of a
worksheet.
Normally I just right click on the tab and rename, but we would like a
formula there if possible to read a certain cell which renames the
worksheet
when that cell is used.






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 same cell in different worksheet with 2 value changing on e Yan Excel Worksheet Functions 0 September 29th 06 03:15 PM
Naming Cell in diffetn worksheet Yan Excel Worksheet Functions 10 September 26th 06 07:36 PM
Naming Cell on differnt worksheet Yan Excel Worksheet Functions 0 September 25th 06 05:52 PM
Naming Worksheet Denis New Users to Excel 2 September 13th 05 05:55 PM
Want info in a specific cell to reflect in another worksheet.. Shiren New Users to Excel 2 June 13th 05 10:16 PM


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