View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Spreadsheet name = cell content?

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" '<=== change to suit
Dim sh As Worksheet

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
On Error Resume Next
Set sh = Worksheets(Target.Value)
On Error GoTo 0
If sh Is Nothing Then
Worksheets.Add(after:=Worksheets(Worksheets.Count) ).Name = Target.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 on the sheet tab, select
'the View Code option from the menu, and paste the code in.





--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tester" wrote in message
...
Hi - can a spreadsheet name within a workbook be told to reflect a cell
value please?

I have a list of suppliers in a column on a control sheet. this list is
dynamic due to adding new suppliers and i would like a spreadsheet for

each
supplier in alphabetical order. I'm thinking that if the spreadsheet names
could be = to a cell content, the workbook will always be alphabetical.

TIA
Chris