Thread: tabs
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default tabs

The code you posted allows the user to put a name in cell A1 of
the active sheet and then activate the code to assign that name
to that sheet.

If you want the names in column C to be used for assignment to
the work sheets, you need to specify:
1. Do the 20 sheets already exist or will new sheets be required?
2. Will every sheet in the workbook be named from the names in
Column C or are you using additional sheets for other data?
3. If you are using other sheets, how many and do you want them
to be the first sheet(s) on the left or last on the right.

The sheets will be named in the same order as the names are
listed in Column C from top to bottom.

"duckie" wrote:

I am still having problems with tab naming
I have a sheet named directory and in column c from c4 to c23 I have
names of players which I want to be named on tabs on 20 work sheets
I was given the following to use but I can not get it to work

Could someone please help me as the football season is ready to start



Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sNAMECELL As String = "A1"
Const sERROR As String = "Invalid worksheet name in cell "
Dim sSheetName As String
With Target
If Not Intersect(.Cells, Range(sNAMECELL)) Is Nothing
Then
sSheetName = Sheets("Sheet1").Range(sNAMECELL).Value
If Not sSheetName = "" Then
On Error Resume Next
Me.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Me.Name Then _
MsgBox sERROR & sNAMECELL
End If
End If
End With
End Sub