Dim memberDic As Object: Set memberDic = CreateObject("Scripting.Dictionary")
Set memberDic("Team A") = CreateObject("Scripting.Dictionary")
memberDic("Team A")("Tanaka") = 1
memberDic("Team A")("Watanabe") = 2
memberDic("Team A")("Shimizu") = 3
For Each person In ActiveSheet.PivotTables(fy).PivotFields("name").PivotItems
If Not memberDic("Team A").Exists(person.Name) Then
'hidden person except Team A
End If
Next person
我想用Exists方法来排除item。你能给我一些建议吗?
发布于 2017-11-06 13:50:12
为问题发布的评论正式化:
修剪数据透视表中的值,以使Exists正常工作:
For Each person In ActiveSheet.PivotTables(fy).PivotFields("name").PivotItems
If Not memberDic("Team A").Exists(Trim(person.Name)) Then
'hidden person except Team A
End If
Next person
https://stackoverflow.com/questions/41688046
复制