View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Pivot + VBA question

It is unclear what you are trying to do.

Dim pvtItm as PivotItem
for each pvtItm in PivotTables(1).PivotFields("Customers")
sStr = pvtItm.Value & vbnewline
Next
msgbox sStr

so you can get the values for each of the pivot items from the PivotItems
collection.

--
Regards,
Tom Ogilvy



"Gunner" wrote in message
...
hi!
I have this formula.(See underneath) Is it possible that
the pivotitem can be picked up by direct the value of cell?
Something like this:
.PivotItems = ShtData.Range("E" & 9).Value

My problem is that there are 1000 different values in
PivotFields "Customers". If it was only 12 entries, I
could just listed them.

Private Sub OptionButton1_Click()
' Months only
Application.ScreenUpdating = False
With ActiveSheet.PivotTables(1).PivotFields
("Customers")
.PivotItems("Jan").Visible = True


Does anyone know how to solve this?

Gunner