teatimecrumpet
Active Member
- Joined
- Jun 23, 2010
- Messages
- 307
Hi,
I've got 56 pivot items in a pivotfield named "ID". What I'm trying to do is go through each pivot item and copy the first row of data under the pivotROWfield to another sheet. So basically only showing one of the pivotfields each time and copying the row I want to another sheet.
I could go through each pivotfield and manually change each other item to false and startin gover but that would be more than 56 times 56 lines of code. Anyway to do this with an IF statiment and/or with an array?
Thsi bad code does not work:
ANY help appreciated! Thanks!
I've got 56 pivot items in a pivotfield named "ID". What I'm trying to do is go through each pivot item and copy the first row of data under the pivotROWfield to another sheet. So basically only showing one of the pivotfields each time and copying the row I want to another sheet.
I could go through each pivotfield and manually change each other item to false and startin gover but that would be more than 56 times 56 lines of code. Anyway to do this with an IF statiment and/or with an array?
Thsi bad code does not work:
Set PT = Sheets("Full-Pivot").PivotTables("fullpivot")
For i = 1 To PT.PivotFields("ID").PivotItems.Count
Sheets("Full-Pivot").PivotTables("fullpivot").ManualUpdate = True
'PT.PivotFields("ID").PivotItems(i).Visible = True
If PT.PivotFields("ID").PivotItems(i).Value <> PT.PivotFields("ID").PivotItems(i).Value Then
PT.PivotFields("ID").PivotItems(i).Visible = False
'PT.PivotFields("ID").PivotItems.Visible = False
Range("A7").Copy Destination:=Sheets("sheet3").Range("A1048576").End(xlUp).Offset(1, 0)
End If
Next i
ANY help appreciated! Thanks!
Last edited: