Active Cell May Change When You Sort a PivotTable
Article ID: 178047
Article Last Modified on 8/19/2003
APPLIES TO
- Microsoft Excel 97 Standard Edition
- Microsoft Excel 98 for Macintosh
This article was previously published under Q178047
SYMPTOMS
In Microsoft Excel 97 and Microsoft Excel 98 Macintosh Edition, when you
sort a PivotTable, the active cell may change, depending on the structure
of the PivotTable.
This behavior may cause a problem if you sort the PivotTable while running
a Visual Basic for Application procedure that assumes that the active cell
has not changed as a result of the sort.
NOTE: This behavior is different from earlier versions of Microsoft Excel.
To see an example of this behavior, see the "More Information" section in
this article.
CAUSE
This problem occurs because Microsoft Excel 97 and Microsoft Excel 98
Macintosh Edition use "structured selection" in PivotTables. This means
that when you sort a PivotTable, Microsoft Excel moves the selection with
the currently selected data. If the selection is not adjacent (not
contiguous), Microsoft Excel selects the upper-right cell in the current
selection.
This behavior is by design of Microsoft Excel.
WORKAROUND
You cannot change this behavior. However, if you are using a Visual Basic
procedure to sort a PivotTable, try modifying the macro so that it does
not assume that the active cell remains unchanged when you sort the
PivotTable.
Additional query words: XL97 XL
Keywords: kbprb KB178047