Microsoft KB Archive/108001

= Microsoft Knowledge Base =

XL5: Copying a Sheet with Identical Local and Global Names
Last reviewed: May 14, 1997

Article ID: Q108001

The information in this article applies to:


 * Microsoft Excel for Windows version 5.0
 * Microsoft Excel for the Macintosh, version 5.0
 * Microsoft Excel for Windows 95, version 7.0
 * Microsoft Excel 97 for Windows

SUMMARY
In Microsoft Excel, if you have a local name "sales" and a global name "sales" that refer to Sheet1, and you make a copy of Sheet1 in that same workbook, you may receive one of the following messages:

Use existing definition of 'sales'

-or-

A formula or sheet you want to move or copy contains the name 'sales', which already exists on the destination worksheet To keep the names defined as they are in the original sheet, choose Yes.

MORE INFORMATION
The following example shows what happens when you have identical local and global names on the same sheet and you copy the sheet within the workbook.

Example

 * 1) Open a new workbook.
 * 2) On the Insert menu, point to Name, and then click Define.
 * 3) Type "sales" in the Names In Workbook box.
 * 4) Click OK. This creates a global name, accessible from every sheet in the workbook.
 * 5) Select cell C1.
 * 6) From the Insert menu, choose Name, and then choose Define.
 * 7) Type "Sheet1!sales" (without quotation marks) in the Names In Workbook box.
 * 8) Click OK. This creates a local name accessible only from Sheet1 that overrides the global name.
 * 9) Hold down the CTRL key and drag the Sheet1 tab past the Sheet2 tab. The message, "Use existing definition of 'sales'," is displayed.

If you choose Yes, the local name "sales" is copied to the new sheet. The global name "sales" is overridden by the local name, just as it was in the original Sheet1. Note, when you are in a sheet that has a local defined name the same as a global defined name, you cannot see the global defined name when this sheet is active.

If you choose No, you are asked to enter a new name which is assigned to the cell that contains the original global name. This new name, however, is now a local name. The local name "sales" is copied to the new sheet.