主题
RowItems (属性)
返回一个 PivotItemList 集合,该集合对应于分类轴上表示选定单元格的项目。
示例
python
#本示例判断单元格 L9 中的数据项是否在第一个行字段中的“name”项之下,并通知用户。本示例假定数据透视表位于活动工作表上,并且工作表的列 L 包含数据透视表的行项目
def test():
# Determine if there is a match between the item and column field.
if Application.Range("L9").PivotCell.RowItems.Item(1).Parent.Name == "name":
print("Cell L9 is a member of the 'name' row field.")
else:
print("Cell L9 is not a member of the 'name' row field.")
python
#本示例显示包含活动单元格的数据透视项行轴上第二个数据项的值
def test():
print(ActiveCell.PivotCell.RowItems.Item(2).Value)