View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default worksheet change?

There are some strings that aren't valid.

Strings that include /, \, [, ], *, ? (and others??).

Strings that are too long (max length for a worksheet name is 31 characters).

And at least one reserved name that excel uses: History

I'm guessing that you have a date (which may include slashes depending on your
regional settings) that's causing the trouble.

If you've formatted the cell nicely (using dashes instead of slashes), you could
try:

ws.Name = ws.Range("G1").Text


jack wrote:

Thanks Nigel
I get an error message for line:
ws.Name = ws.Range("G1")
I don't have duplicate names.
Any ideas why it isn't working?
Jack

"Nigel" wrote in message
...

Put this in the 13th Sheet code, it will change ALL other worksheets in the
workbook. NOTE: if you have duplicate names the code will fail!

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim wS as worksheet
For each wS in Worksheets
ws.Name = ws.Range("G1")
Next
End Sub

--

Regards,
Nigel


"jack" wrote in message
...
I have the following brief macro to change the tab name based on a change
to
cell "G1":

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
ActiveSheet.Name = ActiveSheet.Range("G1")
End Sub

How do I change the tab name on a total of 12 worksheets (different names)
when I make a change on the 13th worksheet?
The 12 worksheets all are linked to the 13 worksheet so that when I change
the 13th sheet, the others are updated and I would like to update (change)
the tab names when the the sheets are updated.
I've thought about placing the above macro in each worksheet but I can't
even get the one to update (name change) when I modify the 13th sheet.
Any guidance would be greatly appreciated.
Jack



--

Dave Peterson