View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default VBA Code to Change the Tab Name

Try this and remember you can't have tabs with same name

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("C1").Value = "" Then End
ActiveSheet.Name = Range("C1").Value
End Sub


"Michael in Texas" wrote:

I have the following code that someone helped me with yesterday that is used
to change the name of the tab to whatever name is in cell "C1.":

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("C1"), Target) Is Nothing Then
Exit Sub
End If
v = Target.Value
ActiveSheet.Name = v
End Sub

The problem is that is seems to work sometimes and then will stop. Or it
won't work when I try to copy the page, etc.

Is there some trick I'm missing? Thanks!