I'm using Excel 2010 and currently writing some VBA code to control my pivot-table.
My issue is that I'm using Shapes to access a vba macro responsible to sort my table and it only works when I sort the first column of my pivot table.
Here's the code I'm using :
Worksheets("Sheet1").PivotTables("Pivot table 1") _
.PivotFields("Data").AutoSort xlAscending, "Data"
But it only works if "Data" is the name of my first column. If I try to sort my table using my second of third column, nothing happens.
I though that maybe I have to remove the sorting from other columns before trying to sort my table but I haven't managed to make that option work and I'm running out of ideas.
Thank you