Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem changing pivot field

Hello-

I am trying to take selections from a ListBox (named Product_Codes)
and use those selections in a pivot table. As a first step I am
trying to deselect all items in a pivot field called "product_code"
but I keep getting an error. Here is my code (sorry if it posts
sloppy):

[vb]Private Sub Create_Report_Click()

Dim iCode As PivotItem
Dim PT As PivotTable

Set PT = Sheets("Network").PivotTables("PivotTable1")

Application.ScreenUpdating = False

' Clear all Product Codes from Pivot Field "product_code"

For Each iCode In PT.PivotFields("product_code").PivotItems
PT.PivotFields("product_code").PivotItems(iCode).V isible = False
'Getting error
here;
Next iCode '"Unable to get PivotItems Property of the
PivotField Class

Application.screendupdating = True

End Sub[/vb]

I know it is difficult without seeing the userform or file, but any
help is appreciated. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problem changing pivot field

Try putting iCode.Value in this loop:

For Each iCode In PT.PivotFields("product_code").PivotItems
PT.PivotFields("product_code").PivotItem
(iCode.Value).Visible = False
Next iCode

-----Original Message-----
Hello-

I am trying to take selections from a ListBox (named

Product_Codes)
and use those selections in a pivot table. As a first

step I am
trying to deselect all items in a pivot field

called "product_code"
but I keep getting an error. Here is my code (sorry if

it posts
sloppy):

[vb]Private Sub Create_Report_Click()

Dim iCode As PivotItem
Dim PT As PivotTable

Set PT = Sheets("Network").PivotTables("PivotTable1")

Application.ScreenUpdating = False

' Clear all Product Codes from Pivot Field "product_code"

For Each iCode In PT.PivotFields

("product_code").PivotItems
PT.PivotFields("product_code").PivotItems

(iCode).Visible = False
'Gettin

g error
here;
Next iCode '"Unable to get PivotItems Property of

the
PivotField Class

Application.screendupdating = True

End Sub[/vb]

I know it is difficult without seeing the userform or

file, but any
help is appreciated. Thanks!
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Problem changing pivot field

Didn't work;

Here is the code again with that change:

Private Sub Create_Report_Click()

Dim iCode As PivotItem
Dim PT As PivotTable
Dim i As Integer
Dim numProds As Integer

numProds = Product_Codes.ListCount

Set PT = Sheets("Network").PivotTables("PivotTable1")

Application.ScreenUpdating = False

' Clear all Product Codes from Pivot Field "product_code"

For Each iCode In PT.PivotFields("Prod Code").PivotItems

With Sheets("Network").PivotTables("PivotTable1").Pivot Fields("Prod
Code")
.PivotItems(iCode.Value).Visible = False
End With

Next iCode

End Sub

I also tried setting all to true in case it was a matter of needing to have
at least one selected. Thanks for your help.


"Anya" wrote in message
...
Try putting iCode.Value in this loop:

For Each iCode In PT.PivotFields("product_code").PivotItems
PT.PivotFields("product_code").PivotItem
(iCode.Value).Visible = False
Next iCode

-----Original Message-----
Hello-

I am trying to take selections from a ListBox (named

Product_Codes)
and use those selections in a pivot table. As a first

step I am
trying to deselect all items in a pivot field

called "product_code"
but I keep getting an error. Here is my code (sorry if

it posts
sloppy):

[vb]Private Sub Create_Report_Click()

Dim iCode As PivotItem
Dim PT As PivotTable

Set PT = Sheets("Network").PivotTables("PivotTable1")

Application.ScreenUpdating = False

' Clear all Product Codes from Pivot Field "product_code"

For Each iCode In PT.PivotFields

("product_code").PivotItems
PT.PivotFields("product_code").PivotItems

(iCode).Visible = False
'Gettin

g error
here;
Next iCode '"Unable to get PivotItems Property of

the
PivotField Class

Application.screendupdating = True

End Sub[/vb]

I know it is difficult without seeing the userform or

file, but any
help is appreciated. Thanks!
.



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 - problem with field Xiden Excel Discussion (Misc queries) 4 July 24th 09 05:25 AM
Changing a field setting in a pivot table The Rook[_2_] Excel Discussion (Misc queries) 3 September 5th 08 05:29 PM
Calculated field problem in a Pivot table gham Excel Discussion (Misc queries) 0 April 17th 08 09:52 PM
Changing field names without affecting pivot table csdjj Excel Discussion (Misc queries) 2 April 15th 08 05:16 PM
Changing field settings on multiple columns in pivot report...How Wayne Charts and Charting in Excel 1 February 7th 06 12:07 AM


All times are GMT +1. The time now is 03:55 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"