VBA Excel PivotTable Drop Down Help
Sub ShowHidePivotItems()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
' Set reference to pivot table
Set pt = ActiveSheet.PivotTables(1)
' Set reference to the pivot field with dates to show/hide
Set pf = pt.PivotFields("Color")
For Each pi In pf.PivotItems
If pi.Value = "orange" Or pi.Value = "green" Then
pi.Visible = True
Else
pi.Visible = False
End If
Next
End Sub
"Ri" wrote in message
oups.com...
Hi,
Okay, so I'm primarily an Access/Web developer, but a client has asked
us to use Microsoft Access to automatically set filter values on their
Excel PivotTables. This has been going okay until I hit a snag. Most
of the filters are single value - meaning there is a drop-down list of
(All), Value1, Value2, etc. However, there are a couple which are
multi-select. There is a drown down list, and instead of selecting one
of the items, you can click on a little checkbox to select 1-many of
the items.
I need to figure out how to set THESE items programmatically. Any
ideas?
Thanks!
|