
楼主,每个透视表 *** 作上,根据实际的数据类型的什么,差别比较大的。
这儿也不好说怎么来做~
使用Excel 2010或2013,录制宏,然后 *** 作下透视表,就能看到具体怎么 *** 作了。
2007有Bug,不要用的好, *** 作的过程好多看不到。
我也做了好些自动筛选的,贴出来,你看下吧,不细说了,可以实现的。
'创建图表
Set cht = wbdSheets("PivotTable")ChartObjectsAdd(wbdSheets("PivotTable")Cells(1, "J")Left + 8, wbdSheets("PivotTable")Cells(1, "J")Top, 708, 284)
chtName = "图表1"
chtChartChartWizard Source:=tbTableRange1
chtChartSetElement (msoElementChartTitleAboveChart)
k = 0
'根据刷新的数据型号,判断取的不良Code
For Each lotype In tbPivotFields("Type")PivotItems
lotype_1 = lotype
tbPivotFields("Type")CurrentPage = lotype_1
'这个地方就是筛选设定的~~~
If UBound(Filter(pdt, lotype)) = 0 Then
tbPivotFields("DGS%")Orientation = xlHidden
tbPivotFields("GCS%")Orientation = xlHidden
tbPivotFields("GGS%")Orientation = xlHidden
tbPivotFields("Glass Qty")Position = 2
With chtChart
ChartTitleText = lotype_1 & "_Tray别Yield确认@Inv%"
ApplyChartTemplate ( _
"F:\Sputter Daily Report自动化\1图表模板\Tray_Yield_TNcrtx")
End With
Else
tbPivotFields("Inv%")Orientation = xlHidden
tbPivotFields("Glass Qty")Position = 4
With chtChart
ChartTitleText = lotype_1 & "_Tray别Yield确认@DGS/GCS/GGS%"
ApplyChartTemplate ( _
"F:\Sputter Daily Report自动化\1图表模板\Tray_Yield_ADScrtx")
End With
End If
你要根据每个PivotField的每个PivotItem来判断是否有折叠。
Sub a()Dim pitem As PivotItem
Dim bShowDetail As Boolean
bshowdetail = True
For Each pitem In ActiveSheetPivotTables("分析表")PivotFields("小组")PivotItems
bshowdetail = bshowdetail And pitemShowDetail
Next
MsgBox IIf(bshowdetail, "无折叠", "至少有一项折叠")
End Sub
以上就是关于如何用vba实现数据透视表自动筛选全部的内容,包括:如何用vba实现数据透视表自动筛选、求教怎么用vba判断数据透视表的字段是否折叠呢、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)