View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John John is offline
external usenet poster
 
Posts: 14
Default Rename a Worksheet on Input of Value in Cell

Just closed the file and opened it up and now whatever I enter in C5 changes
the name of the sheet as desired. Why did it do that when I closed and
reopened?



"John" wrote in message
...
I have the following code with the relevant sheet code. What I'm ytring to
achieve is when a value is entered in C5 then the Worksheet is renamed as
what is entered in C5. Only problem is that it doesn't do anything for me.
What am I doing wrong?

Thanks



Private Sub Worksheet_Change(ByVal Target As Range)
Dim Shouldbe As String
With Target
If .Address = "$C$5" Then
If .HasFormula = False Then
Shouldbe = StrConv(.Value, vbProperCase)
If .Value < Shouldbe Then _
.Value = Shouldbe
End If
End If
End With
End Sub