Naming objects

In addition to providing names for cells and ranges, you can give more meaningful names to objects such as charts and shapes. This can make it easier to refer to such objects, especially when you refer to them in your VBA code.

The Secret to Understanding Cell and Range Names

Excel users often refer to named ranges and named cells. In fact, I've used these terms frequently throughout this chapter. Actually, this terminology is not quite accurate.

Here's the secret to understanding names:

When you create a name for a cell or a range in Excel, you're actually creating a named formula — a formula that doesn't exist in a cell. Rather, these named formulas exist in Excels memory.

When you work with the Define Name dialog box, the Refers To field contains the formula, and the Names in Workbook field contains the formula's name. You'll find that the contents of the Refers To field always begins with an equal sign — which makes it a formula.

This is not exactly an earthshaking revelation, but keeping this "secret" in mind could help you understand what's going on behind the scenes when you create and use names in your workbooks.

Contrary to what you might think, the Insert ^ Name ^ Define command doesn't enable you to name objects; it works only for cells and ranges. The only way to change the name of a nonrange object is to use the Name box, which is located to the left of the formula bar. Just select the item, type the new name in the Name box, and then press Enter.

If you simply click elsewhere in your workbook after typing the name in the Name box, the name won't stick.You must press Enter.

0 0

Post a comment