Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have some VBA that makes changes to multiple Pivot fields at once to show various data in a Pivot Chart. Is there a clean way to have VBA sort the Pivot by say the Grand Total Column (either reverse or ascending) so that the pivot bar chart looks like a pareto.... tallest bars at the left of the stacked bar chart? As an example of a simple single column ("Customer") & row ("Group") field, I want to sort the data so that the customer with highest sales is at the top of the list. Here's a recording of a macro but it just seems to reference cells in the worksheet. The problem is that if I change the colum/row fields, the cell/column/row of the total will also change. Range("I7").Select Selection.Sort Key1:="R7C9", Order1:=xlAscending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Selection.Sort Key1:="R7C9", Order1:=xlDescending, Type:=xlSortValues, _ OrderCustom:=1, Orientation:=xlTopToBottom Range("A7").Select Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _ Orientation:=xlTopToBottom Range("B6").Select Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _ Orientation:=xlLeftToRight Selection.Sort Order1:=xlDescending, Type:=xlSortLabels, OrderCustom:=1, _ Orientation:=xlLeftToRight |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Pivot Table help with data fields | Excel Discussion (Misc queries) | |||
Issue with Multiple sort fields in pivot table | Excel Programming | |||
Data Fields in Pivot Table | Excel Programming | |||
Data Fields in Pivot Table | Excel Discussion (Misc queries) | |||
changing sort for pivot table fields | Excel Programming |