From: Maria on
Your explanation cleared up alot of things for me, I know it's long ago but this thank is needed :)



James_Thomlinso wrote:

What you are talking about is referencing the sheet by code name **Sheet1** or
07-Feb-07

What you are talking about is referencing the sheet by code name **Sheet1**
or by the name property **Sheets("Tab Name")** of the sheet. Recorded macros
use the name property to refernece sheets so a lot of the code that you see
will use that method. When you start writing code from scratch you will find
that the codeename is by far easier and better to use.

To change the code name in the VBE bring up the properties window (View ->
Properties). The first item in the list will be Name. this is the code name.
End users have no ability to modify this. You can change it here from Sheet1
to shtPricing (or something similar. Now to access the sheet via code you
just need to type shtPricing dot and intillisence will populate a list of
properties and methods for you to use. One very important feature is that
since the user can not modify this like the Tab name your code is much less
likely to crash by virtue of end users changing tab names.

When you reference the sheet object indirectly via it's Name property you do
not get an intellisence list and if the user changes the tab name your code
will crash.
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Previous Posts In This Thread:

On Wednesday, February 07, 2007 4:26 PM
TroubledUse wrote:

Excel Objects
I am looking at a Excel file that in VB has Microsoft Excel Object that are
named like:

Siz01_Customer(CustomerName)
Siz02_Product(ProductName)

Below all of are the Sheets that I expected to see. Many of the Siz sheets
are blank or contain a limited amount of code, and in some cases the
SheetName I would expect to show up as:

Sheet1(PricingInfo) is showing up as: Siz03_Pricing(PricingInfo)

Questions:

(1) I have never seen this done before, how do you edit from "Sheet1" to
"Siz03_Pricing"?
(2) Is this a common practice or does/can this cause any type of reference
problems?
(3) How do you edit back to the SheetName?

On Wednesday, February 07, 2007 5:49 PM
James_Thomlinso wrote:

What you are talking about is referencing the sheet by code name **Sheet1** or
What you are talking about is referencing the sheet by code name **Sheet1**
or by the name property **Sheets("Tab Name")** of the sheet. Recorded macros
use the name property to refernece sheets so a lot of the code that you see
will use that method. When you start writing code from scratch you will find
that the codeename is by far easier and better to use.

To change the code name in the VBE bring up the properties window (View ->
Properties). The first item in the list will be Name. this is the code name.
End users have no ability to modify this. You can change it here from Sheet1
to shtPricing (or something similar. Now to access the sheet via code you
just need to type shtPricing dot and intillisence will populate a list of
properties and methods for you to use. One very important feature is that
since the user can not modify this like the Tab name your code is much less
likely to crash by virtue of end users changing tab names.

When you reference the sheet object indirectly via it's Name property you do
not get an intellisence list and if the user changes the tab name your code
will crash.
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

On Wednesday, February 07, 2007 6:00 PM
TroubledUse wrote:

Thank you. This makes perfect sense.
Thank you. This makes perfect sense. I have not used this before but will
start immediately.



"Jim Thomlinson" wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Creating a WPF Custom Control
http://www.eggheadcafe.com/tutorials/aspnet/32d63678-2798-465e-ad29-c0b45fb68b78/creating-a-wpf-custom-con.aspx