Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Page Refresh in Excel Pivottable?
Message
From
28/08/2001 12:05:01
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00529753
Message ID:
00549884
Views:
10
Let me try this one again. In the top combo box in the page area of a pivottable I have all 50 states available. Below that combobox and also in the page area are the top 3 cities for each state (that means there are 150 possible cities).

Now if I select the state of Missouri, I should only see the cities of
Kansas City, St Louis and Springfield. Can this be done via VBA code inside
of excel? If so, an example would be greatly appreciated.

>>Let's say I have two comboboxes in the page area of an Excel 2000 pivottable.
>>The top combobox named states is the list of 50 states and the lower combobox
>>named 'cities' is a list of major cities for each state.
>>
>>What I'd like to see happen is to only show the cities associated with their state when a specific state is selected. I know that the comboboxes work as filters, but a user has asked if this type of functionality can be made to work inside of a pivottable.
>
>The row and column field labels are dropdowns. This lets your users select which columns or rows to display. In your example, they can filter certain cities or certain states. To do this interactively, the user clicks on the dropdown and then checks those items in the list he’d like to see.
>
>You can accomplish this in code with the PivotField object’s PivotItems collection. Each PivotField has a collection of PivotItems, each correlating to a row or column. The heading labels are used as the index name. One of the 19 properties of the PivotItem object is the Visible property. Setting Visible to .F. removes it from the view. Try something like:
>
WITH oPivotTable.PivotFields("<i>fieldname</i>")
>  .PivotItems("Alaska").Visible = .F.
>  .PivotItems("Arizona").Visible = .F.
>ENDWITH
>Note that you'll have to replace fieldname with the name of your field, as it's shown in the PivotTable (if you used .AddFields() to add the field to the PivotTable, then use either the RowField or the ColumnField name that you passed as a parameter).
>
>Hope this helps.
>
> - della
Previous
Reply
Map
View

Click here to load this message in the networking platform