I'm having a little trouble understanding how to go about extracting Pivot Table reports using VBA.
I know that I have to declare my existing pivot table. That's easy.
I want to extract data from it though.
If my Pivot table looks like the below: How do I extract the actual values contributing to the 'count of test_list' = 4 highlighted in red.
When I click on the number '4' below it gives me a separate worksheet with all the values of the letter 'a' contributing to the count of 4. Is it possible to extract this data using VBA? I want to do this so I can print it in a variety of formats automatically. Thanks
I know that I have to declare my existing pivot table. That's easy.
I want to extract data from it though.
If my Pivot table looks like the below: How do I extract the actual values contributing to the 'count of test_list' = 4 highlighted in red.
When I click on the number '4' below it gives me a separate worksheet with all the values of the letter 'a' contributing to the count of 4. Is it possible to extract this data using VBA? I want to do this so I can print it in a variety of formats automatically. Thanks
Row Labels | Count of test_list |
a | 4 |
b | 2 |
c | 2 |
d | 2 |
e | 1 |
f | 1 |
g | 1 |
I | 1 |
j | 1 |
k | 1 |
m | 1 |
Grand Total | 17 |
Code:
Sub pivot_table_test()
Dim pvt As PivotTable
Set pvt = Sheets("Sheet2").PivotTables(1) 'done
'now I want to extract data from it.
End Sub
Last edited: