Here's 2 macros from a previous post by J.E. McGimpsey which will do the job
(with some added-on implementation steps below ..)
---------
From: J.E. McGimpsey (
[email protected])
Subject: Re: Associate name sheet with cell
Newsgroups: microsoft.public.excel.links
Date: 2001-09-06 13:39:34 PST
If by "cell name" you mean cell value, you'd need to use a
Worksheet_Change() event macro (stored in the sheet module) or a
Workbook_SheetChange() event macro (stored in the ThisWorkbook module) (
I don't know if you can automatically change the sheet name based on a
change in range name):
Macro A
-----------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
ActiveSheet.Name = Range("A1").Value
End If
End Sub
or
Macro B
----------
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Sh.Name = Range("A1").Value
End If
End Sub
Charles said:
Is it possible to associate a sheet name to a cell, so
when we change the cell name, the sheet will change at the
same time???
Thanks
Charles
-----------
Some steps to ease-in & quickly implement ..
---------------------------------------------------
Macro A:
Right-click on a sheet tab > Choose "View Code"
Clear the defaults in the white space and paste Macro A there
Type a name, "Peter" in A1 (the target cell) in the sheet, press Enter
Sheet tab will be named "Peter"
Macro B:
Right-click on the Excel icon (to the left of "File" on the menu bar)
Clear the defaults in the white space and paste Macro B there
Type a different name, "Adam" in A1 (the target cell) in *any* sheet, press
Enter
Sheet tab will be named "Adam"
--
Macro A will apply only to the sheet that the code is pasted in,
whilst Macro B will apply to all sheets in the book.
The target cell can be changed to suit.