运行时错误1004'无法获取PivotTable类的PivotFields属性' [英] Run Time Error 1004 'Unable to get the PivotFields property of the PivotTable class'

查看:841
本文介绍了运行时错误1004'无法获取PivotTable类的PivotFields属性'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的不知道此错误是什么意思...我试图使用代码选择数据透视表中子标题之一下的所有行.我收到运行时错误1004无法获取数据透视表类的PivotFields属性".这是代码:

I realy have no Idea what this error means... I am trying to use the code to select all the rows under one of the subheaders in a pivot table. I am getting a run time error 1004 "unable to get the PivotFields property of the Pivot Table class". Here is the code:

 Sub ttest()
 Dim pt As PivotTable
 Set pt = Sheets("Report").PivotTables("PivotTable1")

 pt.PivotFields("Row Labels").PivotItems("CL").DataRange.Select

 End Sub

推荐答案

正如JosieP在评论中所说,1004错误表示没有这样的object,也就是没有这样的pivot field称为行标签".

As JosieP said in the comments, the 1004 error means that there is no such object, that is there is no such pivot field that is called "Row Labels".

这篇关于运行时错误1004'无法获取PivotTable类的PivotFields属性'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆