Microsoft Knowledge Base |
|
XL: Can Use Same Name to Define Object and Defined Name |
|
|
Last reviewed: March 27, 1997
Article ID: Q105769 |
|
5.00 5.00c 7.00 | 5.00
WINDOWS | MACINTOSHkbusage kbtlc
The information in this article applies to:
SUMMARYMicrosoft Excel versions 5.0 and 7.0 store object names and defined names in separate locations in memory. This method of storing names means that a defined name and a named object on the same worksheet can have the same name.
MORE INFORMATIONMicrosoft Excel versions 5.0 and 7.0 allow you to rename objects such as drawn objects, Visual Basic controls, and bitmaps. To rename an object:
Although the name box will display the name of an object when the object is selected, it cannot be used to select an object. Using the above example, if you select the name Square from the name box, the cell named Square will be selected, not the Square object. You can still select the object by clicking it with your mouse.
How to Refer to Named Objects and Defined Names in Visual Basic CodeIf you are writing a Visual Basic macro, you could use this code to select the object Square:
ActiveSheet.Rectangles("Square").Select
To select the range Square, you could use this code:
Range("Square").Select
Because you are able to specify different objects ('Rectangles' versus
'Range'), you are able to select the proper items, even though theyhave the same name.
REFERENCES"User's Guide," version 5.0, Chapters 10 and 13
|
|
KBCategory: kbusage kbtlc
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |