ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Naming Sheets Tabs (https://www.excelbanter.com/excel-worksheet-functions/5761-naming-sheets-tabs.html)

Cgbilliar

Naming Sheets Tabs
 
I have a workbook that contains a sheet called team data, in that sheet I have
10 players names, Player 1 = F6, Player 2 = F7 right thru were Player10 = F15
and each player has its own sheet, when I write a player's name in tean data F6

I would like for that name to automatically appear on a sheet tab for that
player.

example: sheet team data F6 = sheet 1 tab
sheet team data F7 = sheet 2 tab
right thru where team data F15 = sheet 10 tab

Can someone show me how to do this my window looks like this.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

I'm very new at this Thanks.



David McRitchie

Hi ......,
I'm not sure what you actual goal is, but the following will
create a sheetname when you enter something into column F,
and will put your team name into A1 of the new sheet (if one was created).

Private Sub Worksheet_Change(ByVal Target As Range)
Dim newSht As String, oldSht As String
Dim wsOld As Worksheet, wsNew As Worksheet
If Target.Column < 6 Or Target.Row = 1 Then Exit Sub
oldSht = ActiveSheet.Name
Set wsNew = ActiveSheet
newSht = Target.Text
On Error Resume Next
Sheets(newSht).Activate
If Err.Number = 0 Then 'sheet already exists
Sheets(oldSht).Activate 'reactivate team sheet and exit
Exit Sub
End If
On Error Resume Next
'Create New Sheet
Sheets.Add After:=Sheets(Sheets.Count) '-- place at end
ActiveSheet.Name = newSht
Set wsNew = ActiveSheet
wsNew.Cells(1, 1) = "'" & newSht 'name of new sheet into cell
' Sheets(Sheets.Count).Activate 'try to show last tab
Sheets(oldSht).Activate
End Sub

you can use wsNew. to move things from wsOld
You can look over some additional code snippets in
http://www.mvps.org/dmcritchie/excel/sheets.htm
http://www.mvps.org/dmcritchie/excel/bus_sched.htm
Event Macros
http://www.mvps.org/dmcritchie/excel/event.htm

The newsgroup for programming is
microsoft.public.excel.programming
but by including some code, it was clear you knew how to
set up an event macro.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Cgbilliar" wrote in message ...
I have a workbook that contains a sheet called team data, in that sheet I have
10 players names, Player 1 = F6, Player 2 = F7 right thru were Player10 = F15
and each player has its own sheet, when I write a player's name in tean data F6

I would like for that name to automatically appear on a sheet tab for that
player.

example: sheet team data F6 = sheet 1 tab
sheet team data F7 = sheet 2 tab
right thru where team data F15 = sheet 10 tab

Can someone show me how to do this my window looks like this.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

I'm very new at this Thanks.





Cgbilliar

Thanks Dave:
I will apply this information to my program and see what happens.I was afraid
I wasn't making myself clear enough when I was posting this information,I have
written a program that keeps team statistics and individual statistics for the
game of pool (Billiards), I have 10 separate sheets for 10 players and I have
one sheet that keeps the team's data all in one workbook. The problem is at the
beginning of every session I may have new players on the roster which is
located in the team data sheet I would like for each name on this roster of 10
from F6 to F15 to appear on each individual sheet tab for each player so I dont
have to write it again on each sheet tab.
Thanks again, this is all new to me so I am learning as I go.




All times are GMT +1. The time now is 05:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com