Linking Names in Worksheets to Worksheet Tabs

  • Thread starter Thread starter RudeRam
  • Start date Start date
R

RudeRam

Is there a way to link a name in a worksheet to that worksheet tab?
ask this because I have several workbooks and want to have the name
match the tabs, even when the names change.

TIA for any help:
 
From a recent post by Frank K. in:
http://tinyurl.com/36nlo

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
application.enableevents = false
With Target
If .Value <> "" Then
Me.Name = .value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub
-------
Steps
-------
Right-click on the sheet tab > View Code

In VBE
---------
In the white space on the right-side
delete all the defaults appearing there
and paste Frank's sub above

Press Alt+Q to get back to Excel

Test by typing a name into cell A1

The sheet tab will automatically take on the name in A1

You can also change the target cell "A1" in the sub to say "B1"
in the line:

If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
 

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

Back
Top