Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
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
Sheet tab names change automatically MD Excel Discussion (Misc queries) 2 June 27th 09 04:32 PM
update a sheet automatically with changing values from another she QP1 Excel Worksheet Functions 1 July 17th 08 07:54 PM
Update Summary Sheet Automatically MarkT Excel Discussion (Misc queries) 7 December 18th 07 07:43 PM
how do I update a sheet automatically with the info from another? Richard New Users to Excel 3 April 21st 06 08:17 PM
Automatically update links when server names change J Hotch Excel Worksheet Functions 1 August 3rd 05 03:50 PM


All times are GMT +1. The time now is 01:49 AM.

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"