vba pivot table sorting

J

joemeshuggah

is it possible to sort by the grand total column in a pivot table using vba?
what is the proper code to do so?
 
R

ryguy7272

Turn on the macro recorder, then go through the steps of building your pivot
table. After you build your pivot table, double-click on the 'pivot' in the
upper left corner of the pivot table. A screen pops up; click on 'Advanced'
then choose your 'AutoSort Options'.

After you do all that, go back and check your code. You syntax will be
different from mine, but eventually, you should probably get code somewhat
similar to this
ActiveSheet.PivotTables("PivotTable1").PivotFields(Sheets("Summary").Range("C5").Value).AutoSort _
xlDescending, "Count of "

Just try it and see what happens. You may be pleasantly surprised!!

Regards,
Ryan---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top