Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically name worksheet tab w/cell formula

I would like to be able to automatically name my worksheet
tabs.

Is there a cell formula or macro that I can use so that:

If: The contents of cell A1 is 'January 1, 2004'
Then: The worksheet tab automatically is changed to
'January 1, 2004'

Also, can anyone recommend books on VB programming
(beginner level) for Excel?

Thanks,

Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Automatically name worksheet tab w/cell formula

Hi Bill
this requieres VBA. You could use the worksheet_change event. E.g. the
following code will change the tab name based of the value in cell A1.
Put this in your worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
If .Value < "" Then
Me.Name = .Value
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Bill B wrote:
I would like to be able to automatically name my worksheet
tabs.

Is there a cell formula or macro that I can use so that:

If: The contents of cell A1 is 'January 1, 2004'
Then: The worksheet tab automatically is changed to
'January 1, 2004'

Also, can anyone recommend books on VB programming
(beginner level) for Excel?

Thanks,

Bill


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Automatically name worksheet tab w/cell formula

One way:

Put this in the ThisWorkbook code module (right-click on the workbook
title bar and choose View Code):

Private Sub Workbook_SheetChange( _
ByVal Sh As Object, ByVal Target As Excel.Range)
With Target(1)
If Not Intersect(.Cells, Sh.Range("A1")) Is Nothing Then
On Error Resume Next
Sh.Name = .Value
On Error GoTo 0
End If
End With
End Sub

For a real beginner level VBA book, John Walkenbach's "Excel 2000
Programming for Dummies" may be in your library. However, if you spend
any time at it, you'll quickly get past that.

Two others I recommend:

John's "Excel 2002 Power Programming with VBA"

and

Bovey, Bullen, Green and Rosenberg's "Excel 2002 VBA: Programmers
Reference"


In article ,
"Bill B" wrote:

I would like to be able to automatically name my worksheet
tabs.

Is there a cell formula or macro that I can use so that:

If: The contents of cell A1 is 'January 1, 2004'
Then: The worksheet tab automatically is changed to
'January 1, 2004'

Also, can anyone recommend books on VB programming
(beginner level) for Excel?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically name worksheet tab w/cell formula

You can use the code:

Sheets(i).Name = Range("A1").value

If in A1 you have some value the workshhet will update aftwer you willl
run the Macro


---
Message posted from http://www.ExcelForum.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
Automatically copy a cell from one worksheet to another SHARON Excel Discussion (Misc queries) 2 February 25th 09 04:09 PM
Move cell data to another worksheet cell automatically. Alan New Users to Excel 3 April 6th 08 08:05 PM
Changing worksheet name within a formula (automatically) dave Excel Discussion (Misc queries) 5 December 20th 07 02:37 PM
How I can set all cell in the worksheet rounddown automatically? Poh Yong Excel Worksheet Functions 0 July 19th 06 06:09 AM
how do I display the name of a worksheet automatically in a cell? Archie N. Excel Discussion (Misc queries) 2 August 22nd 05 07:01 PM


All times are GMT +1. The time now is 11:10 PM.

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"