E_DPSG
Board Regular
- Joined
- Jul 17, 2008
- Messages
- 82
I am getting a debug error with setting the position within a pivot.
Here is my code:
I get the count of items correctly, and it does enter the if clause for visibility, but will not assign the position.
Any Ideas?
Here is my code:
Code:
VisibleItems=0
For Each PvtField in PvtTabe.RowFields
if pvtField.Name = "MyName" then
for each pvtItem in pvtField.PivotItems
if pvtItem.Visible=true then VisibleItems=VisibleItems+1
next
end if
next
if ActiveSheet.PivotTables("MyPivotTable").PivotFields("MyName").PivotItems("MyItem").visible Then
ActiveSheet.PivotTables("MyPivotTable").PivotFields("MyName").PivotItems("MyItem").position = VisibleItems
End IF
Any Ideas?