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 Programming (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.

Thanks & Regards
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
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 Programing Help (Selecting Pivot Items) Manish Jaitly[_2_] Excel Programming 0 May 25th 07 12:38 PM
Pivot table programming havocdragon Excel Programming 1 September 14th 06 02:57 PM
Pivot Table Selecting Items AK Excel Programming 1 May 2nd 05 08:02 PM
Pivot table Programming Kris Excel Programming 1 October 5th 04 09:03 PM


All times are GMT +1. The time now is 09:26 AM.

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"