Microsoft Knowledge Base

XL: Unexpected Behavior with Center Across Selection Format

Last reviewed: September 13, 1996
Article ID: Q139802
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0, 5.0
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for the Macintosh, versions 4.0, 5.0

SYMPTOMS

When you use the Center Across Selection option (under Alignment in the Format Cells dialog box), you may not receive the results you expect.

For example, if you select a range of cells and use the Center Across Selection format to format the range, and you then select a range of cells in a row adjacent to the original range and apply the Center Across Cells format to that range, text that you enter into the first range will be centered across both ranges.

Example

Enter text in cell A1 and center it from cells A1:C1. Then, enter text in D1 and center it across the range D1:F1. If you delete the text in D1, the text in A1 is centered from A1 to F1.

WORKAROUND

To avoid this behavior, remove the Center Across Selection format from extra cells to reset the center of the Center Across Selection range.

CAUSE

When you use the Center Across Selection format, Microsoft Excel looks for a continuous range of cells that is formatted with Center Across Selection. Once it has the continuous range, Microsoft Excel looks to the leftmost cell and takes any text written there and centers it within the range.

Because Microsoft Excel looks for a continuous range, any changes made to the cells along the rightmost edge of the range will make a difference in how the text is displayed. In the "Example" section of this article, when D1:F1 is formatted with Center Across Selection, Microsoft Excel sees a larger continuous range formatted with Center Across Selection. That is, center across selection is now continuous for the entire range A1:F1. As a result, the text in A1 is shifted to the right and the "selection" is set to A1:F1.

MORE INFORMATION

If the center across selection range has values or text in them, center across selection behaves differently; this difference in behavior occurs because, in addition to looking for a continuous range formatted with center across selection, Center Across Selection also checks to see if the cells are empty. If cells contain text or values, Center Across Selection is applied to each section between the values.

Using the above example, the text in A1 is centered from A1:F1. If text is entered in cell E1, Microsoft Excel adjusts the A1 text to be centered from A1:D1. Also, Microsoft Excel takes the text in E1 and centers it between E1:F1.


KBCategory: kbusage
KBSubcategory:

Additional reference words: 4.00 5.00 7.00



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 13, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.