Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Sorting after subtotal

My user wants the subtotals in a specific order --- which is not
alphabetical. She has numbered the order the subtotals should appear. Any
other subtotal groups will follow the listed subtotal groups. Note: these
groups may or may not always exists in a report.

1. Cash
2. Bonds
3. Common Stock
4. Common Funds
5. Other category
6. Other category......

'----------------------------------------------------------- Sort
' Range("A1:I1").Select
' ActiveCell.SpecialCells(xlLastCell).Select
' Range("A1").Select
' Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
' Selection.Sort Key1:=Range("A4"), Order1:=xlAscending,
Key2:=Range("C4") _
' , Order2:=xlAscending, Key3:=Range("B4"), Order3:=xlAscending,
Header:= _
' xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
' xlSortNormal
''----------------------------------------------------------- SubTotal
' Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4,
5, 6, 7, _
' 8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
' Range("A1:I1").Select
' ActiveWorkbook.Save


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Sorting after subtotal

Just a suggestion.
Put a macro in that will do a sort for you. If you label the cells like this.
1 Cash
2 Bonds
3 Common
etc, the 'sort data' will use the numbers to sort so it will always put the
reults in any order you number them.
If a group is not in the report (such as 2 Bonds) sort data will look for
the next chronological number.

"SharonInGa" wrote:

My user wants the subtotals in a specific order --- which is not
alphabetical. She has numbered the order the subtotals should appear. Any
other subtotal groups will follow the listed subtotal groups. Note: these
groups may or may not always exists in a report.

1. Cash
2. Bonds
3. Common Stock
4. Common Funds
5. Other category
6. Other category......

'----------------------------------------------------------- Sort
' Range("A1:I1").Select
' ActiveCell.SpecialCells(xlLastCell).Select
' Range("A1").Select
' Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
' Selection.Sort Key1:=Range("A4"), Order1:=xlAscending,
Key2:=Range("C4") _
' , Order2:=xlAscending, Key3:=Range("B4"), Order3:=xlAscending,
Header:= _
' xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
' xlSortNormal
''----------------------------------------------------------- SubTotal
' Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4,
5, 6, 7, _
' 8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
' Range("A1:I1").Select
' ActiveWorkbook.Save


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Sorting after subtotal

The raw data I am manipulating is from an email. My task is to write a
macro formatting this data to a final report that the users do not have to
manipulate.

How do you sort using variables?




"SharonInGa" wrote:

My user wants the subtotals in a specific order --- which is not
alphabetical. She has numbered the order the subtotals should appear. Any
other subtotal groups will follow the listed subtotal groups. Note: these
groups may or may not always exists in a report.

1. Cash
2. Bonds
3. Common Stock
4. Common Funds
5. Other category
6. Other category......

'----------------------------------------------------------- Sort
' Range("A1:I1").Select
' ActiveCell.SpecialCells(xlLastCell).Select
' Range("A1").Select
' Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
' Selection.Sort Key1:=Range("A4"), Order1:=xlAscending,
Key2:=Range("C4") _
' , Order2:=xlAscending, Key3:=Range("B4"), Order3:=xlAscending,
Header:= _
' xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
' xlSortNormal
''----------------------------------------------------------- SubTotal
' Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4,
5, 6, 7, _
' 8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
' Range("A1:I1").Select
' ActiveWorkbook.Save


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting and subtotal in a filtered list Ken W Excel Discussion (Misc queries) 1 December 1st 09 08:02 PM
Sorting a subtotal list by the subtotals Ken W Excel Discussion (Misc queries) 2 February 24th 09 05:51 PM
Subtotal sorting ab3d4u[_3_] Excel Worksheet Functions 2 September 7th 07 08:32 PM
Sorting subtotal results gls858 New Users to Excel 5 February 13th 05 12:06 PM
Subtotal results in new column and then sorting subtotals ArtM Excel Worksheet Functions 1 January 18th 05 12:21 AM


All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"