View Single Post
  #3   Report Post  
Piranha
 
Posts: n/a
Default


MissSunshineKiss Wrote:
Hi. I'm try to figure out a function that will automate renaming the
worksheet by reading a cell entry. For instance....if i have a
timesheet
format, I would like the user to be able to enter their name in a cell
(a2,
for instance) and then have a macro re-name the worksheet tab to
reflect
their name.

I know this is possible by browsing through the VB properties. I am
just
unsure of the correct code syntax.

Thanks loads!

Miss,
Where cell A5 is the cell in which the name is entered.
Put code into the Sheet module.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A5")) 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

Dave


--
Piranha
------------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435
View this thread: http://www.excelforum.com/showthread...hreadid=382665