提问人:GregH 提问时间:9/26/2023 最后编辑:JohnMGregH 更新时间:9/26/2023 访问量:33
在VBA中,如何确定数据透视表的顶部或底部是否有小计?
In VBA, how do I find if a pivot table has subtotals at top or bottom?
问:
使用 VBA,我想了解数据透视表的顶部或底部是否有小计。
我试过使用
Activesheet.Pivottables(1).xlSubtotalsLocationType
但得到了
运行时错误 438。
我正在尝试保存数据透视表的格式,以便以后可以恢复它。我已经开发了大部分代码来将数据透视表的参数保存在 Excel 表格中,并使用保存的信息恢复数据透视表。
答:
0赞
taller
9/26/2023
#1
' Update pivottable and pivotfield name as needed
ActiveSheet.PivotTables("PivotTable1").PivotFields("PivotField").LayoutSubtotalLocation
返回值为
名字 | 价值 | 描述 |
---|---|---|
xlAtBottom (英语) | 2 | 小计将位于底部。 |
xlAt顶部 | 1 | 小计将位于顶部。 |
Microsoft 参考文档:
评论