I managed to generate a Pivot table using VBA, but now not sure how to sort the "Grand Total" column on the right from Largest to Smallest using VBA that the pivot table generates. A little googling and I found https://docs.microsoft.com/en-us/office/vba/api/excel.pivotfield.autosort but I am not sure how exactly to implement it for the desired result. I have tried moving things around, but seem to be missing some underlying logic (as you will see in this Pastebin link https://pastebin.com/jpjxrTyQ). The VBA code works well up until 'Insert Data field (Count of "group").
I'm definitely not seeing something basic. Any help is appreciated.