XL97: Incorrect Field Names Appear in PivotTable Field Dialog BoxID: Q202232
|
In the PivotTable Field dialog box, the Hide Items list may display field names that are not contained within the source data range of the PivotTable.
This problem occurs when the following conditions are true:
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft Support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/The following sample macro code deletes all of the fields in the PivotTable and then refreshes the PivotTable. Only the fields that are currently in the source data range will be displayed in the PivotTable Field dialog box.
Sub Delete_Fields()
On Error Resume Next
For Each pvtfield In Worksheets("X").PivotTables("Y").PivotFields
For Each pvtitem In pvtfield.PivotItems
pvtitem.Delete
Next
Next
ActiveSheet.PivotTables("Y").RefreshTable
End Sub
where "X" is the name of the worksheet you wrote down in step 1 and "Y" is the name of the PivotTable you wrote down in step 1.Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
Additional query words: XL97
Keywords : kbdta kbdtacode KbVBA
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 17, 1999