Hello,

I have several command buttons and toggle buttons that users can use to manipulate the row and value fields of several pivot tables. I'd like to add code to set the AutoSort of whatever field is in the table to Ascending based on the value fields. I know the code below will work, but I need to write the code so that whatever row field is present in the pivot table is sorted instead of specifying the row field.

The code below works, but instead of specifying the "Region" pivot field, I want the code to autosort whatever pivot field is present in the pivot table.
Please Login or Register  to view this content.
I've tried this code, but it doesn't seem to be doing anything. I'm not getting an error, but the pivot tables are also not being sorted when I run the code. I'm new to "For-Next" statements (and VBA altogether), so I'm sure I'm missing something here.

Please Login or Register  to view this content.
Any help is greatly appreciated!

Thank you,
Jen