Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Pivot Table Programing Help (Selecting Pivot Items)

Hi

I need some help on pivot table programming. My purpose is that the vba code
should read a column with names in one excel workbook and select the same
names in a particular pivot field in another excel workbook. There are
hundreds of names and if done manually it takes a lot of time to manually
select the names (pivot items) in the pivot field.

Here is my code

Dim pt As PivotTable
Dim pi2 As PivotItem
Dim ws1 As Worksheet
Dim ws2 As Worksheet


Set ws1 = Workbooks("Quality Monitoring Data1.xls").Worksheets("EMZ
Attributes-Pivot")
Set ws2 = Workbooks("EMZ FOCUS GROUPS 1.xls").Worksheets("Collated EMZ Focus
Groups")

Set pt = ws1.PivotTables("pivottable4")
pt.PivotFields("SE Alias").PivotItems("(Select All)").Visible = False -
I do not see blank so "Select All" must NOT be clicked so that in the
beginning there are no selections and selections can then be made.

For Each c In ws2.Range("b2:b64000")
If c.Offset(0, 2) = "EMEA EMS" And c.Offset(0, 6) = "Green" Then
pt.PivotFields("SE Alias").PivotItems(c).Visible = True
End If
Next c

When I run the above code I get the run time error message 1004 that says
"Unable to get the pivotitems property of the pivot field class"

Please help me out with this error as this work done manually is taking a
lot of my time.

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 table - old items Goodlighting Excel Discussion (Misc queries) 2 November 12th 08 08:26 PM
How I can create a Pivot table by selecting two Different Pivot Rajini Excel Worksheet Functions 1 August 22nd 08 01:45 AM
Pivot Table Items Alan B Excel Discussion (Misc queries) 3 May 4th 08 06:24 PM
Pivot table items suepro Excel Discussion (Misc queries) 1 December 6th 05 05:01 PM
Pivot Table Selecting Items AK Excel Programming 1 May 2nd 05 08:02 PM


All times are GMT +1. The time now is 11:37 PM.

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

About Us

"It's about Microsoft Excel"