countryfan_nt
Well-known Member
- Joined
- May 19, 2004
- Messages
- 765
Hello friends, hope all is well!
please help me I am trying to choose more than one choice on a pivot table with VBA.
But didn't succeeded.
Your time & Effort is really appreciated!
I tried the below code, but it didn't work.
please help me I am trying to choose more than one choice on a pivot table with VBA.
But didn't succeeded.
Your time & Effort is really appreciated!
Code:
Sub AAA()
Sheets("PTDocRev").Select
ActiveSheet.PivotTables("DrMnAct").PivotFields("Visit Count").CurrentPage = _
"(All)"
With ActiveSheet.PivotTables("DrMnAct").PivotFields("Visit Count")
.PivotItems(" - ").Visible = False
.PivotItems(" 1 ").Visible = False
.PivotItems(" 2 ").Visible = False
.PivotItems(" 3 ").Visible = False
.PivotItems(" 4 ").Visible = False
.PivotItems(" 5 ").Visible = False
.PivotItems(" 6 ").Visible = False
.PivotItems(" 7 ").Visible = False
.PivotItems(" 8 ").Visible = False
.PivotItems(" 9 ").Visible = False
.PivotItems(" 10 ").Visible = False
End With
End Sub
I tried the below code, but it didn't work.
Code:
Sub AAA()
Sheets("PTDocRev").Select
ActiveSheet.PivotTables("DrMnAct").PivotFields("Visit Count").CurrentPage = _
"(All)"
With ActiveSheet.PivotTables("DrMnAct").PivotFields("Visit Count")
.PivotItems(" - ", " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 ", " 10 ").Visible = False
End With
End Sub
Last edited: