Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Update Sheet Names
Hi All,
Does anybody know how I can automatically name the sheets of a workbook based on the contents of a cell. For example, if I have the word January in Cell A:1, I would like the Sheet name to be January. If I change January to May, I would like the sheet to automatically update and rename itself to May. Any ideas? Thanks, Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Update Sheet Names
Hi Steve,
Try: '================== Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range Set rng = Range("A1") On Error Resume Next If Not Intersect(Target, rng) Is Nothing Then If Not IsEmpty(rng) Then Sheet2.Name = rng.Value End If End If On Error GoTo 0 End Sub '<<================== --- Regards, Norman "Steve" wrote in message news:pIj7f.298576$tl2.109713@pd7tw3no... Hi All, Does anybody know how I can automatically name the sheets of a workbook based on the contents of a cell. For example, if I have the word January in Cell A:1, I would like the Sheet name to be January. If I change January to May, I would like the sheet to automatically update and rename itself to May. Any ideas? Thanks, Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Update Sheet Names
If you want it for all sheets in a book, try
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Const WS_RANGE As String = "A1" On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Sh.Range(WS_RANGE)) Is Nothing Then With Target If .Value < "" Then Sh.Name = .Value End If End With End If ws_exit: Application.EnableEvents = True End Sub 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH RP (remove nothere from the email address if mailing direct) "Steve" wrote in message news:pIj7f.298576$tl2.109713@pd7tw3no... Hi All, Does anybody know how I can automatically name the sheets of a workbook based on the contents of a cell. For example, if I have the word January in Cell A:1, I would like the Sheet name to be January. If I change January to May, I would like the sheet to automatically update and rename itself to May. Any ideas? Thanks, Steve |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Update Sheet Names
Thanks guy's,
The code works just great! Steve *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sheet tab names change automatically | Excel Discussion (Misc queries) | |||
update a sheet automatically with changing values from another she | Excel Worksheet Functions | |||
Update Summary Sheet Automatically | Excel Discussion (Misc queries) | |||
how do I update a sheet automatically with the info from another? | New Users to Excel | |||
Automatically update links when server names change | Excel Worksheet Functions |