Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Worksheet Name
Is there a way for a Worksheet name to be changed the the
value in a particular cell I would like the value for example in cell C1 to be the worksheet name Thanks Nigel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Worksheet Name
If the sheet you wish to name is active then use....
ActiveSheet.Name = Range("C1") If it is called Sheet1 then use.... Worksheets("Sheet1").Name = Range("C1") If the active sheet is not providing the value from range C1 then use.... Worksheets("Shhet1").Name = Worksheets("Sheet").Range("C1") NOTE: If C1 is empty you will get an error. -- Cheers Nigel "Nigel Bennett" wrote in message ... Is there a way for a Worksheet name to be changed the the value in a particular cell I would like the value for example in cell C1 to be the worksheet name Thanks Nigel |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Worksheet Name
Nigel
To have the worksheet tab name follow the cell value....... From Bob Phillips.......... Private Sub Worksheet_Change(ByVal Target As Range) 'autoname the worksheet Tab from value in A5 If Target.Cells.Count 1 Then Exit Sub If Intersect(Target, Me.Range("A5")) Is Nothing Then Exit Sub On Error GoTo CleanUp Application.EnableEvents = False With Target If .Value < "" Then Me.Name = .Value End If End With CleanUp: Application.EnableEvents = True End Sub Alternative on a button or shortcut key. Sub SheetName() ActiveSheet.Name = Range("A5") End Sub Gord Dibben Excel MVP On Sat, 7 May 2005 09:17:56 -0700, "Nigel Bennett" wrote: Is there a way for a Worksheet name to be changed the the value in a particular cell I would like the value for example in cell C1 to be the worksheet name Thanks Nigel |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Worksheet Name
Nigel
Addendum to my other post. The Worksheet_Change is sheet event code. Right-click on the sheet tab and paste the code into that sheet module. Gord Dibben Excel MVP On Sat, 7 May 2005 09:17:56 -0700, "Nigel Bennett" wrote: Is there a way for a Worksheet name to be changed the the value in a particular cell I would like the value for example in cell C1 to be the worksheet name Thanks Nigel |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Worksheet Name
You can put your code in the change event of the worksheet.
Still need to catch errors for invalid names Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = Range("C1").Address Then ActiveSheet.Name = Range("C1").Value End Sub "Nigel Bennett" wrote: Is there a way for a Worksheet name to be changed the the value in a particular cell I would like the value for example in cell C1 to be the worksheet name Thanks Nigel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet setting error... | Excel Worksheet Functions | |||
Setting up a worksheet | Excel Worksheet Functions | |||
setting a copied worksheet | Excel Programming | |||
Help with setting up a worksheet funtion | Excel Worksheet Functions | |||
setting tab name for worksheet | Excel Programming |