Worksheet Naming

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to set my Worksheet names which show up on the worksheet tabs, by using the contents of cell A1 in each worksheet

Help

Thanks
 
Hi
you'll need VBA for this(an event procedure: see
http://www.cpearson.com/excel/events.htm for more details): Put the
following code in your worksheet module:
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:
With Target
If .Value <> "" Then
Me.Name = .Value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

you have to put this in all relevant worksheet modules
 
No need for it since you're not changing the value of a cell.

CleanUp:
Application.EnableEvents = True

can go away too, by converting

On Error GoTo Cleanup

to

On Error Resume Next
 
Thanks for your help. Your solution negated a very time consuming problem I have been dealing with for some time.
 

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