CellsEx Property

Microsoft Office Web Components Visual Basic

expression.CellsEx(Row, Column, Page)

expression    Required. An expression that returns a PivotData object.

Row   Required PivotRowMember object. Specifies the row containing the returned cell.

Column   Required PivotColumnMember object. Specifies the column containing the returned cell.

Page   Required PivotPageMember object. Specifies the page containing the returned cell.

Example

This example sets a variable to the total amount shipped via 2-Day shipping to postal code 28016 in North Carolina.

Sub Get2DayShippingToNC()

    Dim ptData
    Dim pmRowMember
    Dim pmColMember
    Dim pmPageMember
    Dim pmIntersection
    Dim dblShipTotal

    Set ptData = PivotTable1.ActiveData

    ' Set a variable to a row field member.
    Set pmRowMember = ptData.RowAxis.Member.ChildAxisMembers("North Carolina")

    ' Set a variable to a column field member.
    Set pmColMember = ptData.ColumnAxis.Member.ChildAxisMembers("2-Day")

    ' Set a variable to a page field member.
    Set pmPageMember = ptData.PageAxis.Member.ChildAxisMembers("28016")

    ' Set a variable to the intersection of the row, column, and page field members.
    Set pmIntersection = ptData.CellsEx(pmRowMember, pmColMember, pmPageMember)

    ' Set a variable to the total shipping amount for the item.
    dblShipTotal = pmIntersection.Aggregates("Shipping").Value

End Sub