ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   tab naming from a set cell (https://www.excelbanter.com/excel-discussion-misc-queries/160599-tab-naming-set-cell.html)

duckie

tab naming from a set cell
 
I am having problem with work sheet naming from a cell I know this has
been posted before by other people but I can't get it to work i copy
and paste what they say and i just can't get it to work

On sheet 1 cell c8 I want sheet 2 tab name Tom or a number
On sheet 1 cell c9 I want sheet 3 tab name Ray or a number


Bob Phillips

tab naming from a set cell
 
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C8:C9" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Address = "$C$8" Then
Worksheets("Sheet2").Name = .Value
Else
Worksheets("Sheet3").Name = .Value
End If
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

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"duckie" wrote in message
ups.com...
I am having problem with work sheet naming from a cell I know this has
been posted before by other people but I can't get it to work i copy
and paste what they say and i just can't get it to work

On sheet 1 cell c8 I want sheet 2 tab name Tom or a number
On sheet 1 cell c9 I want sheet 3 tab name Ray or a number





All times are GMT +1. The time now is 02:17 AM.

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