View Single Post
  #19   Report Post  
Posted to microsoft.public.excel.misc
SAM SEBAIHI SAM SEBAIHI is offline
external usenet poster
 
Posts: 58
Default *How can you rename a tab based on a cell value

Bob, thank you so much, you saved my life. I am trying to modify this code to do the following:


data in sheet (1)

A
1 name
2 Brian
3 John
4 kim
5 Sam
6 ...
7 ...

I wanted to create new sheets with name tabs based on A2, A3, A4..etc... Can you please help?



--------------------------------------------------------------------------------

Sam Sebaihi
Faculty
Western International University
Associate Programs

(alternate email)
Phone #: (405)315-8223 Time zone: Pacific Time
"Bob Phillips" wrote in message ...
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
"SAM SEBAIHI" wrote in message ...

How can you rename a tab based on a cell? example,

if cell A1 contains John then the tab of sheet (1) renamed to john.

thank you,