O'Reilly logo

Excel® 2007 VBA Programmer's Reference by Michael Alexander, Rob Bovey, Stephen Bullen, John Green

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Using Names

One of the most useful features in Excel is the ability to create names. You can create a name by selecting the Formulas tab on the Ribbon and clicking the Name Manager button to display the Name Manager dialog box, shown in Figure 5-1. If the name refers to a range, you can create it by selecting the range, typing the name into the Name box at the left side of the Formula bar, and pressing Enter. However, in Excel, names can refer to more than just ranges.

Figure 5-1

Figure 5-1. Figure 5-1

A name can contain a number, text, or a formula. Such a name has no visible location on the worksheet and can only be viewed in the Name Manager dialog box. Therefore, you can use names to store information in a workbook without having to place the data in a worksheet cell. Names can be declared hidden so they don't appear in the Name Manager dialog box. This can be a useful way to keep the stored information from being seen by users.

The normal use of names is to keep track of worksheet ranges. This is particularly useful for tables of data that vary in size. If you know that a certain name is used to define the range containing the data you want to work on, your VBA code can be much simpler than it might otherwise be. It is also relatively simple, given a few basic techniques, to change the definition of a name to allow for changes that you make to the tables in your code.

The Excel object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required