ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cell and tab naming (https://www.excelbanter.com/excel-discussion-misc-queries/169560-cell-tab-naming.html)

bpoland58

Cell and tab naming
 
Is there any way to make a tab take on the name of a given cell automatically?

(Ex. If 1 enter Joe in A-1 a specific tab will be named Joe)

Bob Phillips

Cell and tab naming
 
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = .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


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



"bpoland58" wrote in message
...
Is there any way to make a tab take on the name of a given cell
automatically?

(Ex. If 1 enter Joe in A-1 a specific tab will be named Joe)





All times are GMT +1. The time now is 02:37 PM.

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