【问题标题】:Get the selected pivot table name - Excel VBA获取选定的数据透视表名称 - Excel VBA
【发布时间】:2014-11-17 13:59:22
【问题描述】:

我在一张 Excel 表上有两个数据透视表。我想知道您如何使用 Excel VBA 获取选定数据透视表的名称?

我试过ActiveSheet.PivotTables.Selected,但这不是受支持的属性。

【问题讨论】:

    标签: excel pivot-table vba


    【解决方案1】:

    您只需使用:

    ActiveCell.PivotTable.Name
    

    或者,有一点错误处理:

    Dim PT as PivotTable
    On Error Resume Next
    Set PT = Activecell.PivotTable
    On Error Goto 0
    If not PT is nothing then msgbox pt.name
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多