Hi Experts,
I am trying to unselect the pivot items and then select just one item with vba which equals one of my variable?
Could you give me some advises regarding this issue. I appreciate your responses.
i am using the following code which is not working
PHP Code:
Sub test()
Dim n As Integer
Dim x As Integer
n = ActiveSheet.PivotTables("PivotTable5").PivotFields("xx").PivotItems.Count
For x = 1 To n
On Error Resume Next
With thePT.PivotFields("xx")
If x = myvariable Then
.PivotItems(x).Visible = True
Else
.PivotItems(x).Visible = False
End If
DoEvents
End With
Next x
End Sub
Bookmarks