VisibleFields Method

Applies To

PivotTable Object.

Description

Accessor. Returns an object that represents a single pivot field (a PivotField object, Syntax 1) or a collection of the visible pivot fields (a PivotFields object, Syntax 2). Visible pivot fields are showing as row, column, page or data fields. Read-only.

Syntax 1

object.VisibleFields(index)

Syntax 2

object.VisibleFields

object

Required. The PivotTable object.

index

Required for Syntax 1. The name or number of the pivot field to return (can be an array to specify more than one).

See Also

ColumnFields Method, DataFields Method, HiddenFields Method, PageFields Method, PivotFields Method, RowFields Method.

Example

This example adds the visible field names 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)
For Each hdnField In pvtTable.VisibleFields
    newListBox.AddItem (hdnField.Name)
Next hdnField
Worksheets("Sheet1").Activate