Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Programming with Pivot Tables

Hello Excel Users!!

I am developing a macro which uses pivot tables to gather
data. Several times throughtout the programming I
am "filtering" the data by limiting the pivot table
fields. When writing the VBA for this I am using:

With ActiveSheet.PivotTables("PivotTable1").PivotFields
("xxxxxx")
..PivotItems("xxxxx").Visible = False
..PivotItems("xxxxx").Visible = True
End With

1. Is there anyway not to have to list all the items I
want Visible or not Visible?

2. Also the list is not always constant yet the items I
want "Filtered" is. Is there a way to write the
programming just to list the items I want visible?

Thanks for any help you can offer!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA Programming with Pivot Tables

No1,

This might help.

You can replace the name of the pivotfield with an index
number. Remember to leave at least one field showing at
all times or you will generate an error. Indexing will
work for all of the collections in a pivot table.

for i = 1 to x
ActiveSheet.PivotTables("PivotTable1").PivotFields (i)_
.visible = false
next i

Regards,
Mike




-----Original Message-----
Hello Excel Users!!

I am developing a macro which uses pivot tables to

gather
data. Several times throughtout the programming I
am "filtering" the data by limiting the pivot table
fields. When writing the VBA for this I am using:

With ActiveSheet.PivotTables("PivotTable1").PivotFields
("xxxxxx")
..PivotItems("xxxxx").Visible = False
..PivotItems("xxxxx").Visible = True
End With

1. Is there anyway not to have to list all the items I
want Visible or not Visible?

2. Also the list is not always constant yet the items I
want "Filtered" is. Is there a way to write the
programming just to list the items I want visible?

Thanks for any help you can offer!!


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot tables - Editing the data source shared by multiple pivot ta sankat Excel Discussion (Misc queries) 1 April 22nd 10 03:05 PM
Building pivot tables in Excel 2007 based on existing pivot tables? [email protected] Excel Discussion (Misc queries) 4 December 26th 07 08:05 PM
Average Calculations from Pivot Tables - Get Pivot Data? Calc Fiel westy Excel Worksheet Functions 5 March 10th 07 01:31 AM
How does the term 'pivot' apply to Excel's Pivot tables and Pivot. stvermont Excel Discussion (Misc queries) 1 February 17th 05 01:34 AM
Pivot tables-controlling user interaction with pivot tables Sindhura Excel Programming 0 August 27th 03 02:10 PM


All times are GMT +1. The time now is 11:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"