楼主,每个透视表操作上,根据实际的
数据类型的什么,差别比较大的。
这儿也不好说怎么来做~
使用Excel 2010或2013,录制宏,然后操作下透视表,就能看到具体怎么操作了。
2007有Bug,不要用的好,操作的过程好多看不到。
我也做了好些自动筛选的,贴出来,你看下吧,不细说了,可以实现的。
'创建图表
Set cht = wbd.Sheets("PivotTable").ChartObjects.Add(wbd.Sheets("PivotTable").Cells(1, "J").Left + 8, wbd.Sheets("PivotTable").Cells(1, "J").Top, 708, 284)
cht.Name = "图表1"
cht.Chart.ChartWizard Source:=tb.TableRange1
cht.Chart.SetElement (msoElementChartTitleAboveChart)
k = 0
'根据刷新的数据型号,判断取的不良Code
For Each lotype In tb.PivotFields("Type").PivotItems
lotype_1 = lotype
tb.PivotFields("Type").CurrentPage = lotype_1
'这个地方就是筛选设定的~~~
If UBound(Filter(pdt, lotype)) = 0 Then
tb.PivotFields("DGS%").Orientation = xlHidden
tb.PivotFields("GCS%").Orientation = xlHidden
tb.PivotFields("GGS%").Orientation = xlHidden
tb.PivotFields("Glass Qty").Position = 2
With cht.Chart
.ChartTitle.Text = lotype_1 & "_Tray别Yield确认@Inv%"
.ApplyChartTemplate ( _
"F:\Sputter Daily Report自动化\1.图表模板\Tray_Yield_TN.crtx")
End With
Else
tb.PivotFields("Inv%").Orientation = xlHidden
tb.PivotFields("Glass Qty").Position = 4
With cht.Chart
.ChartTitle.Text = lotype_1 & "_Tray别Yield确认@DGS/GCS/GGS%"
.ApplyChartTemplate ( _
"F:\Sputter Daily Report自动化\1.图表模板\Tray_Yield_ADS.crtx")
End With
End If