cool1_boy1
New Member
- Joined
- Mar 19, 2013
- Messages
- 21
Let's say I have a Pivot Table that looks like this but it has over 50 rows:
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Letter[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]
In the table above the Letter B has a total of 0 hours so it is filtered out; therefore, it isn't displayed.
I want to create a loop that displays the number of Hours for each Letter that is in the table. When it gets to Letter B, I get an error. What's the workaround?
Here's my code:
Thanks!
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Letter[/TD]
[TD]Hours[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]
In the table above the Letter B has a total of 0 hours so it is filtered out; therefore, it isn't displayed.
I want to create a loop that displays the number of Hours for each Letter that is in the table. When it gets to Letter B, I get an error. What's the workaround?
Here's my code:
Code:
For Each pt_item In pt.PivotFields("Letter").PivotItems
MsgBox pt.PivotFields("Letter").PivotItems(pt_item.Value).DataRange.Value
Next
Thanks!