Hi,
I have a pivot table that was generated by using a power query data model. I have a filter on the pivot table called "EmpName" and I would like to iterate through all the EmpNames in the filter, copy the resulting pivot table data to a new workbook and save it as an entirely new workbook, and then move on to the next "EmpName".
My main issue is writing the "For each" statement to iterate through all the report filters in the pivot table.
When I used the macro recorder and interacted with the report filter in the pivot table (that was generated from the data model) this was the code generated:
I have a pivot table that was generated by using a power query data model. I have a filter on the pivot table called "EmpName" and I would like to iterate through all the EmpNames in the filter, copy the resulting pivot table data to a new workbook and save it as an entirely new workbook, and then move on to the next "EmpName".
My main issue is writing the "For each" statement to iterate through all the report filters in the pivot table.
When I used the macro recorder and interacted with the report filter in the pivot table (that was generated from the data model) this was the code generated:
VBA Code:
ActiveSheet.PivotTables("pvt_prepare").PivotFields("[master_name].[EmpName].[EmpName]")