How do I link the worksheet tab to a cell in the worksheet?

H

Husker87

I want to link the tab of the worksheet to a cell. I type in something
different into a cell and the tab at the bottom automatically changes... can
Excel do that for me?
 
A

Andy Brown

Husker87 said:
I want to link the tab of the worksheet to a cell. I type in something
different into a cell and the tab at the bottom automatically changes... can
Excel do that for me?

A macro can. Rightclick the sheet tab, select "View Code". Paste this into
the worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 100
If Selection.Cells.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Address = "$A$1" Then
ActiveSheet.Name = Target
End If
Exit Sub
100:
MsgBox "Invalid sheet name."
End Sub

Press ALT+Q to return to Excel.

NB: assumes "a cell" = A1.

HTH,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top