Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Auto naming Tabs in a Workbook

Is there a way to automatically name/rename a tab based on the cell contents
in a worksheet? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 341
Default Auto naming Tabs in a Workbook

Johnny,

Here is a start for you. It renames based on the values of column A.
So, if you start a blank workbook with 3 sheets and write in the cells
A1 = "pig"
A2 = "horse"
A3 = "cow"
then run this program, you will end up with 3 sheets called pig, horse and
cow.


Sub namesheets()

Dim x As Integer

For x = 1 To Sheets.Count
Sheets(x).Name = Cells(x, 1).Value
Next x

End Sub
--
Allllen


"Johnny" wrote:

Is there a way to automatically name/rename a tab based on the cell contents
in a worksheet? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Auto naming Tabs in a Workbook

Thanks for your reply Alan. In my workbook, I have 4 workseets in which I
do not want to rename the tabs. Let me be a little more discriptive on what
I need. I want to be name each tab based on the cell contains in particular
that particular worksheet. For examples, if cell A1 in worksheet 1 is "Bob"
then name the tab Bob. Can you help? Thanks.

"Allllen" wrote:

Johnny,

Here is a start for you. It renames based on the values of column A.
So, if you start a blank workbook with 3 sheets and write in the cells
A1 = "pig"
A2 = "horse"
A3 = "cow"
then run this program, you will end up with 3 sheets called pig, horse and
cow.


Sub namesheets()

Dim x As Integer

For x = 1 To Sheets.Count
Sheets(x).Name = Cells(x, 1).Value
Next x

End Sub
--
Allllen


"Johnny" wrote:

Is there a way to automatically name/rename a tab based on the cell contents
in a worksheet? Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Auto naming Tabs in a Workbook

I meant to say that I did not want to rename all of the tabs in the workbook.
I do however wish to auto re-name only a select view base on the cells
contents in that tab.

"Johnny" wrote:

Thanks for your reply Alan. In my workbook, I have 4 workseets in which I
do not want to rename the tabs. Let me be a little more discriptive on what
I need. I want to be name each tab based on the cell contains in particular
that particular worksheet. For examples, if cell A1 in worksheet 1 is "Bob"
then name the tab Bob. Can you help? Thanks.

"Allllen" wrote:

Johnny,

Here is a start for you. It renames based on the values of column A.
So, if you start a blank workbook with 3 sheets and write in the cells
A1 = "pig"
A2 = "horse"
A3 = "cow"
then run this program, you will end up with 3 sheets called pig, horse and
cow.


Sub namesheets()

Dim x As Integer

For x = 1 To Sheets.Count
Sheets(x).Name = Cells(x, 1).Value
Next x

End Sub
--
Allllen


"Johnny" wrote:

Is there a way to automatically name/rename a tab based on the cell contents
in a worksheet? Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Auto naming Tabs in a Workbook

Johnny

You can paste this code into the sheet module of those you wish to rename
automatically.

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

This is sheet event code.

Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.

Change the value of A1 and sheet name will follow.


Gord Dibben MS Excel MVP


On Tue, 29 Aug 2006 05:28:01 -0700, Johnny
wrote:

I meant to say that I did not want to rename all of the tabs in the workbook.
I do however wish to auto re-name only a select view base on the cells
contents in that tab.

"Johnny" wrote:

Thanks for your reply Alan. In my workbook, I have 4 workseets in which I
do not want to rename the tabs. Let me be a little more discriptive on what
I need. I want to be name each tab based on the cell contains in particular
that particular worksheet. For examples, if cell A1 in worksheet 1 is "Bob"
then name the tab Bob. Can you help? Thanks.

"Allllen" wrote:

Johnny,

Here is a start for you. It renames based on the values of column A.
So, if you start a blank workbook with 3 sheets and write in the cells
A1 = "pig"
A2 = "horse"
A3 = "cow"
then run this program, you will end up with 3 sheets called pig, horse and
cow.


Sub namesheets()

Dim x As Integer

For x = 1 To Sheets.Count
Sheets(x).Name = Cells(x, 1).Value
Next x

End Sub
--
Allllen


"Johnny" wrote:

Is there a way to automatically name/rename a tab based on the cell contents
in a worksheet? Thanks.


Gord Dibben MS Excel MVP
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
Can you sort sheet tabs in a workbook Techtrainer Excel Discussion (Misc queries) 5 May 18th 06 11:12 AM
How do I change the auto filter tabs from blue to red? Daryl Bruce Setting up and Configuration of Excel 0 May 11th 06 01:11 PM
selecting multiple sheet tabs and open another workbook Bannor Excel Discussion (Misc queries) 5 November 25th 05 02:38 AM
Setup Entire Workbook to print all tabs Duplex John Jr. Excel Worksheet Functions 1 August 4th 05 06:46 PM
Auto Fill workshseet tabs? Sandy@theblade Excel Discussion (Misc queries) 1 August 2nd 05 08:40 PM


All times are GMT +1. The time now is 09:57 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"