Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sheet tab = Cell Value 1

Status
Not open for further replies.

Wray69

Technical User
Oct 1, 2002
299
US
Hello all,

Have'nt been here in awhile. Not sure if this is even possible, if it is I know it will be VB, but;

Is there any way to link the sheet names to a particular cell that if that cell is changed it will change the sheet tab name?

Looking forward to your help.

Wray
 

Hi,

take a look at the CELL worksheet function
[tt]
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
[/tt]


Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Thanks, that changes the cell when you change the tab name, I need to change the tab name when the cell value changes. Is that possible?

Wray
 
LOL - My first thought also Skip till I read it again :)

Regards
Ken............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Hi Wray, long time no see :)

I'm guessing you will need a change event macro tied to that cell.

Regards
Ken..........

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Try this:-

Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Put this in the worksheet code module (right-click on the worksheet
'tab, choose View Code, paste the code in the window that  opens, then
'click the XL icon on the toolbar to return to XL):
  
On Error GoTo ErrHandler:

  If Not Intersect(Target, Range("A1")) Is Nothing Then
    Application.EnableEvents = False
      ActiveSheet.Name = Target.Value
      Application.EnableEvents = True
  End If

ErrHandler:
  If Err.Number = 1004 Then
     MsgBox "You can't use an existing sheet's name, Try again!!"
     Application.EnableEvents = True
     Exit Sub
  End If
End Sub

Regards
Ken........

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 

oops [blush]

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Thaks Ken, works like a charm... Thanks to you also skip. I might be going back into the tech side of the business here, if so I will be around more often.

Cheers,

Wray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top