FuNeS13
Board Regular
- Joined
- Oct 25, 2016
- Messages
- 161
- Office Version
- 365
- 2016
- Platform
- Windows
- Mobile
- Web
So I have this loop working to filter a pivot table, but now I need to filter a couple of charts as well:
I need a similar code but with a chart, when I record the process I get this code but I don't know how to modify it to work as I try:
My logic would be something like:
but i'm completily lost... (yeah my code doesn't work...)....................... any help will be greatly appreciated.
VBA Code:
Dim pf As PivotField
Set pf = ActiveSheet.PivotTables("TOP10").PivotFields("Buyer")
With pf
.ClearManualFilter
.EnableMultiplePageItems = True
For i = LBound(pvtFilter) To UBound(pvtFilter)
On Error Resume Next
.PivotItems(pvtFilter(i)).Visible = False
Next i
End With
I need a similar code but with a chart, when I record the process I get this code but I don't know how to modify it to work as I try:
VBA Code:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(1).IsFiltered = True
ActiveChart.FullSeriesCollection(2).IsFiltered = False
My logic would be something like:
VBA Code:
Dim ChrtObj As ChartObject
Dim value As String
value = "9"
Set ChrtObj = ActiveSheet.ChartObjects("Chart 2")
With ChrtObj
For j = 1 to 10 '(this is the amount of items in the filter, 10)
ActiveChart.FullSeriesCollection(chrtobject).IsFiltered = True
Next j
.ActiveChart.FullSeriesCollection(value).IsFiltered = False
End With
but i'm completily lost... (yeah my code doesn't work...)....................... any help will be greatly appreciated.