View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Rename Worksheet From Cell Data

Private Sub Worksheet_Change(ByVal Target As Range)
'autoname the worksheet Tab from value in A1
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

Right-click on the sheet tab and "View Code". Copy/paste the code into that
module.

Edit "A1" TO SUIT.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP

On Fri, 19 Feb 2010 23:47:17 -0800, navel151
wrote:

Is there a way to rename a worksheet based on a cell in the worksheet?