Tab referenced to a cell

C

Charles Eaves

I am using Excel 2007. I would like to use the content of a cell (A1) to
also be the name of my tab at the bottom of the sheet.
Example: In cell A1, it contains the name: BOB.
I would like the name of the tab at the bottom of the sheet to reflect what
is in cell A1as BOB.
Can this be done?
Thanks
 
G

Gord Dibben

All tabs or just one tab?

Event code for all tabs....................

Place in Thisworkbook module.

Private Sub Workbook_SheetCalculate(ByVal sh As Object)

'for just one sheet change the event type to
'Private Sub Worksheet_Calculate()
'and place in the sheet module

On Error GoTo endit
Application.EnableEvents = False
With ActiveSheet.Range("A1")
If .Value <> "" Then
ActiveSheet.Name = .Value
End If
End With
endit:
Application.EnableEvents = True
End Sub

When a calculation takes place on any sheet, the sheet name will reflect
what is in A1 of that sheet.

If same name as other sheet or contains invalid characters the event will
simply end...............no change in sheet name.


Gord Dibben MS Excel MVP
 
C

Charles Eaves

One tab.
As always, thank you very much!!!!!!!!
Gord Dibben said:
All tabs or just one tab?

Event code for all tabs....................

Place in Thisworkbook module.

Private Sub Workbook_SheetCalculate(ByVal sh As Object)

'for just one sheet change the event type to
'Private Sub Worksheet_Calculate()
'and place in the sheet module

On Error GoTo endit
Application.EnableEvents = False
With ActiveSheet.Range("A1")
If .Value <> "" Then
ActiveSheet.Name = .Value
End If
End With
endit:
Application.EnableEvents = True
End Sub

When a calculation takes place on any sheet, the sheet name will reflect
what is in A1 of that sheet.

If same name as other sheet or contains invalid characters the event will
simply end...............no change in sheet name.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top