*How can you rename a tab based on a cell value
Sam
With your names in A2:A10 of Sheet1
Sub Add_Sheets()
Dim rCell As Range
For Each rCell In Sheets("Sheet1").Range("A1:A10")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Gord Dibben MS Excel MVP
On Wed, 2 Jan 2008 12:31:16 -0800, "SAM SEBAIHI"
wrote:
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,
|