Rename a Worksheet on Input of Value in Cell

  • Thread starter Thread starter John
  • Start date Start date
J

John

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
 
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?
 

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