Special Names

Excel uses some names internally to track certain features. When you apply a print range to a worksheet, Excel gives that range the name Print_Area as a local name. If you set print titles, Excel creates the local name Print_Titles. If you select the Data tab on the Ribbon and click the Advanced button in the Sort & Filter chunk to extract data from a list to a new range, Excel creates the local names Criteria and Extract.

In older versions of Excel, the name Database was used to name the range containing your data list (or database). Although it is no longer mandatory to use this name, Database is still recognized by some Excel features such as Advanced Filter.

If you create a macro that uses the ActiveSheet.ShowDataForm method to edit your data list, you will find that the macro does not work if the data list does not start in A1. You can rectify this by applying the name Database to your data list.

You need to be aware that Excel uses these names, and in general, you should avoid using them unless you want the side effects they can produce. For example, you can remove the print area by deleting the name Print_Area. The following two lines of code have the same effect if you have defined a print area:

ActiveSheet.PageSetup.PrintArea = "" ActiveSheet.Names("Print_Area").Delete

Excel 2007 also generates special names if you use the Table feature to manage a list of data. By default, Excel calls the tables Table1, Table2, and so on. These names appear in the Name Manager dialog box but are not included in the Names collection. They can't be deleted manually in the Name Manager or in code that references the Names collection. For more information on the Table feature, see Chapter 6.

To summarize, you need to take care when using the following names:







0 0

Post a comment