Page field and array selection
Bernie, I know I am being more than usually stupid, but what is ShowMe? Is
it a variable?
--
Sharon
"Bernie Deitrick" wrote:
Sharon,
I'm sorry: I should have taken your b& indexing out:
For Each pi In pf.PivotItems
ShowMe = False
For j = lbound(astate$) to ubound(astate$)
if pi.value = astate$(j) then
ShowMe = True
end if
next j
pi.Visible = ShowMe
Next pi
HTH,
Bernie
MS Excel MVP
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Sharoan,
I think your problem may be indexing: it appears that your aState array may not 'line up' with the
pivotitmes array.
Perhaps, try this:
For Each pi In pf.PivotItems
For b& = 1 To a&
ShowMe = False
For j = lbound(astate$) to ubound(astate$)
if pi.value = astate$(j) then
ShowMe = True
end if
next j
pi.Visible = ShowMe
Next b&
Next pi
HTH,
Bernie
MS Excel MVP
"Sharon" wrote in message
...
Hi
I have a series of pivots where the user wants to select a number of options
and have the pivot fields automatically filter to those options. The user
selections are being captured in an array. However, I don't know how to set
the page filters so that they show all of the selected items. The following
code just results in the last array item being used as the page filter. Any
help would be very much appreciated.
For Each pi In pf.PivotItems
For b& = 1 To a&
If pi.Value = aState$(b&) Then
pi.Visible = True
Else
pi.Visible = False
End If
Next b&
Next pi
--
Sharon
|