数据透视表的多重筛选

数据透视表的多重筛选

我有一个包含 2 个过滤器的数据透视表:主 LOB 和子 LOB。每当我从过滤器中选择一个主 LOB 时,系统都会显示所有可用的子 LOB,而不仅仅是显示所选主 LOB 的子 LOB。如何仅显示所选主 LOB 的子 LOB?

以下是我目前所掌握的信息:

With PT
If pf1.CurrentPage.Name = CurrentCat Then
  For Each pit In pf2.PivotItems
      With Destn1
        .Value = pit.Name & " Agents "
        With .Font
          .Name = "Calibri"
          .Size = 11
          .Underline = xlUnderlineStyleSingle
          .Bold = True
        End With
      End With
      Set Destn1 = Destn1.Offset(2)
      pf2.ClearAllFilters    'added this line (makes it a bit more robust).
      pf2.CurrentPage = pit.Name
      With .TableRange1
        .Copy
        Destn1.PasteSpecial Paste:=xlPasteAll
        Application.CutCopyMode = False
        Set myTable = NewSht.ListObjects.Add(xlSrcRange, Destn1.Resize(.Rows.Count, .Columns.Count), , xlYes)
        myTable.TableStyle = "TableStyleMedium14"
        myTable.ShowTableStyleRowStripes = False
        Set Destn1 = Destn1.Offset(.Rows.Count + 2)
      End With    '.TableRange1
      myTable.Unlist
    Next pit
  End If
'End If
End With    'PT

相关内容