Custom sorting pivot tables

efrank02

New Member
Joined
Jul 13, 2011
Messages
3
Hey there,

I'm working on code which loads data into multiple pivot tables in a user form. I want to sort some tables to be sorted alphabetically, and some to be sorted custom (specifically, AAA, AA, A, BBB, BB, B).

I'm new to VB and not sure if there's a sorting property for the PivotTable object that I can play around with to only sort some tables like I mentioned or if I should approach it a different way.

Any help would be greatly appreciated, thanks.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Thanks a lot, I've recorded a macro that so that the custom sort for pivot tables works in the normal workbook.

The problem I'm having is the pivot table I'm trying to sort is in a user form, and I can't figure out how to apply the Custom Sort List that I've made.

In the VB code, there's a function that loads the pivot table into the form- is there a field on the PivotTable object that allows me to sort it?

Here's the macro I made if it helps:
Range("J6").Select '(this is the cell with the field name)
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=6, Orientation:=xlTopToBottom

Maybe there's a way to .Select the PivotTable in the form?
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top