Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 1.91 KB

Excel.pivottable.pivotvaluecell.md

File metadata and controls

60 lines (38 loc) · 1.91 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
PivotTable.PivotValueCell method (Excel)
vbaxl10.chm235203
vbaxl10.chm235203
9edb96f1-f728-de21-bcc2-e8f0e9110b74
05/09/2019
medium

PivotTable.PivotValueCell method (Excel)

Retrieve the PivotValueCell object for a given PivotTable provided certain row and column indices.

Syntax

expression.PivotValueCell (RowLine, ColumnLine)

expression A variable that represents a PivotTable object.

Parameters

Name Required/Optional Data type Description
RowLine Optional Variant If of type PivotLine, specifies the PivotLine in the row area that the PivotValueCell is aligned with. If of type Int, specifies the position of the PivotLine on the row area that the PivotValueCell is aligned with. If missing, Empty, Null, or 0 specifies the grand total row.
ColumnLine Optional Variant If of type PivotLine, specifies the PivotLine in the column area that the PivotValueCell is aligned with. If of type Int, specifies the position of the PivotLine on the column area that the PivotValueCell is aligned with. If missing, Empty, Null or 0 specifies the grand total column.

Return value

PIVOTVALUECELL

Example

This code sample uses the PivotValueCell property to test whether the value of one cell in a PivotTable is greater than the value of another cell.

Sub TestEquality()
Dim X As Double
Dim Y As Double

'This code assumes you have a Standalone PivotChart on one of the worksheets
X = ThisWorkbook.PivotTables(1).PivotValueCell(1, 1).Value
Y = ThisWorkbook.PivotTables(1).PivotValueCell(1, 2).Value

If X > Y Then
MsgBox "X is greater than Y"
Else
MsgBox "Y is greater than X"
End If
End Sub

[!includeSupport and feedback]