can I name an excel worksheet tab by linking to worksheet data?

J

jasarussell

When data is typed into a cell on a worksheet, can that same data be paste
linked to the worksheet tab for tab naming purposes? Office XP is being used.
 
G

Gord Dibben

Only through VBA.

Event code.......

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

This is sheet event code fired when A1 value changes.

Right-click on your sheet tab and "View Code".

Copy/paste the above into that module.


Gord Dibben Excel MVP
 
J

Jamesie24

How would this work the other way round?? I want a cell to pre populat
when i name a worksheet tab?

Lis
 
Top