Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet setting error... Lakshmi Murthy Excel Worksheet Functions 0 September 23rd 09 03:03 PM
Setting up a worksheet Setting a Mileage Expense Report Excel Worksheet Functions 1 November 14th 07 07:44 PM
setting a copied worksheet Doug Glancy Excel Programming 2 April 14th 05 08:47 PM
Help with setting up a worksheet funtion mjh Excel Worksheet Functions 2 November 11th 04 10:06 PM
setting tab name for worksheet Jan Eikeland Excel Programming 4 December 11th 03 08:45 PM


All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"