Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 23
Default renaming worksheets/objects in VBA

Hello,

I am using Excel 2003, and I have recently inherited a workbook with 5
worksheets. I did not create the workbook or name the sheets originally.
When I open the VBA editor, my worksheets are labelled like this in the
Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet10 (Work Data)
Sheet43 (Misc Calcs)
Sheet65 (Offerings)
Sheet8 (Data Entry)

When I view the workbook in Excel, the sheet tabs are named only with the
above text that is in the ( )s, and NOT with the sheet number. So in Excel
the tabs running across the bottom are labelled:

Greeting, Work Data, Misc Calcs, Offerings, Data Entry

I know how to change these names in ( )s both within Excel and with VBA.
But what I do not know is how to change or remove the "Sheet65" portion of
the name that displays in the VBA Editor.

If I cannot remove the "Sheet#" portion, can I at least change them to be
chronoligal?

As a minimum, when I open the VBA editor, I would like my worksheets
labelled like this in the Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet2 (Work Data)
Sheet3 (Misc Calcs)
Sheet4 (Offerings)
Sheet5 (Data Entry)

Any ideas?

Thanks,

Scott
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default renaming worksheets/objects in VBA

the name you refer to is the "codename". it can't be changed
programmatically, but you can change it by clicking view/properties while in
VBA and changing the name in the properties window. Or, while in Excel,
activate the control toolbox (view/toolbars/control toolbox) and click the
properties button on the toolbar.

the codename can be used to reference worksheets instead of the tab name.
since the code name generally changes less frequently than the tab name, it
requires you to change your code less often (and it allows users to change
the tab names to whatever they want w/o causing problems).

Assuming a worksheet has a tab name of "Sheet1" and its codename is
Sheet1CodeName, you could reference it using either name:

Worksheets("Sheet1").Range("A1").Value = 1
Sheet1CodeName.Range("A1").Value = 1


"scottydel" wrote:

Hello,

I am using Excel 2003, and I have recently inherited a workbook with 5
worksheets. I did not create the workbook or name the sheets originally.
When I open the VBA editor, my worksheets are labelled like this in the
Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet10 (Work Data)
Sheet43 (Misc Calcs)
Sheet65 (Offerings)
Sheet8 (Data Entry)

When I view the workbook in Excel, the sheet tabs are named only with the
above text that is in the ( )s, and NOT with the sheet number. So in Excel
the tabs running across the bottom are labelled:

Greeting, Work Data, Misc Calcs, Offerings, Data Entry

I know how to change these names in ( )s both within Excel and with VBA.
But what I do not know is how to change or remove the "Sheet65" portion of
the name that displays in the VBA Editor.

If I cannot remove the "Sheet#" portion, can I at least change them to be
chronoligal?

As a minimum, when I open the VBA editor, I would like my worksheets
labelled like this in the Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet2 (Work Data)
Sheet3 (Misc Calcs)
Sheet4 (Offerings)
Sheet5 (Data Entry)

Any ideas?

Thanks,

Scott

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default renaming worksheets/objects in VBA

One other caveat - if the workbook contains VBA code, make sure the original
creator did not use the codenames in the program code. If so, changing them
will require you to modify the code.


"JMB" wrote:

the name you refer to is the "codename". it can't be changed
programmatically, but you can change it by clicking view/properties while in
VBA and changing the name in the properties window. Or, while in Excel,
activate the control toolbox (view/toolbars/control toolbox) and click the
properties button on the toolbar.

the codename can be used to reference worksheets instead of the tab name.
since the code name generally changes less frequently than the tab name, it
requires you to change your code less often (and it allows users to change
the tab names to whatever they want w/o causing problems).

Assuming a worksheet has a tab name of "Sheet1" and its codename is
Sheet1CodeName, you could reference it using either name:

Worksheets("Sheet1").Range("A1").Value = 1
Sheet1CodeName.Range("A1").Value = 1


"scottydel" wrote:

Hello,

I am using Excel 2003, and I have recently inherited a workbook with 5
worksheets. I did not create the workbook or name the sheets originally.
When I open the VBA editor, my worksheets are labelled like this in the
Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet10 (Work Data)
Sheet43 (Misc Calcs)
Sheet65 (Offerings)
Sheet8 (Data Entry)

When I view the workbook in Excel, the sheet tabs are named only with the
above text that is in the ( )s, and NOT with the sheet number. So in Excel
the tabs running across the bottom are labelled:

Greeting, Work Data, Misc Calcs, Offerings, Data Entry

I know how to change these names in ( )s both within Excel and with VBA.
But what I do not know is how to change or remove the "Sheet65" portion of
the name that displays in the VBA Editor.

If I cannot remove the "Sheet#" portion, can I at least change them to be
chronoligal?

As a minimum, when I open the VBA editor, I would like my worksheets
labelled like this in the Project Window under Microsoft Excel Objects:

Sheet1 (Greeting)
Sheet2 (Work Data)
Sheet3 (Misc Calcs)
Sheet4 (Offerings)
Sheet5 (Data Entry)

Any ideas?

Thanks,

Scott

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
Renaming worksheets Teeny Excel Discussion (Misc queries) 8 August 18th 09 10:21 PM
Renaming worksheets Mike Allen Excel Discussion (Misc queries) 8 January 21st 07 02:15 AM
Batch renaming of worksheets Lumen S Excel Discussion (Misc queries) 1 August 17th 06 08:35 PM
Problem renaming worksheets ArenaNinja Excel Discussion (Misc queries) 1 April 19th 06 02:40 AM
Renaming Worksheets Steve Walford Excel Worksheet Functions 3 April 1st 05 09:29 PM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"