Applies To
PivotField Object.
Description
Accessor. Returns an object that represents one visible pivot item (a PivotItem object, Syntax 1) or a collection of all the visible pivot items (a PivotItems object, Syntax 2) in the specified field. Read-only.
Syntax 1
object.VisibleItems(index)
Syntax 2
object.VisibleItems
object
Required. The PivotField object.
index
Required for Syntax 1. The number or name of the pivot item to return (can be an array to specify more than one).
See Also
ChildItems Method, HiddenItems Method, ParentItems Method, PivotItems Method.
Example
This example adds the names of all visible items in the field named "COMPANY" to a list box. The list box appears on Sheet1.
Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable Set newListBox = Worksheets("Sheet1").ListBoxes.Add _ (Left:=10, Top:=72, Width:=144, Height:=144) Set pvtField = pvtTable.PivotFields("COMPANY") For Each pvtItem In pvtField.VisibleItems newListBox.AddItem (pvtItem.Name) Next pvtItem Worksheets("Sheet1").Activate