Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a spreadsheet with the following columns: Item # 1 to 1000 Account Number alphanumeric 20 characters long Amount 1 Amount 2 Period 1 Period 2 Data is currently sorted by Amount 2 ( largest to smallest). There are multiple entries for the same account. What I want to do is now group the data so that All the same account numbers are grouped together along with all other fields but in this grouping I want the amounts to keep the current sort largest to smallest ( largest to smallest).If an account as three numbers I want them on the sheet in consecutive lines Thanks for all your help, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave,
In Exel 2007 I recorded this macro for you: Sub Dave() ' ' Dave Macro ' ' Select area with data Range("A1").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select ' Sort Acsending on account nd descending on Amount 2 ActiveWorkbook.Worksheets("Blad1").Sort.SortFields .Clear ActiveWorkbook.Worksheets("Blad1").Sort.SortFields .Add _ Key:=Range("B2:B81"), SortOn:=xlSortOnValues, _ Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets("Blad1").Sort.SortFields .Add _ Key:=Range("D2:D81"), SortOn:=xlSortOnValues, _ Order:=xlDescending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Blad1").Sort .SetRange Range("A1:F81") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With ' Group on Account with as bonus totals Selection.Subtotal GroupBy:=2, Function:=xlSum, _ TotalList:=Array(3, 4), Replace:=True, _ PageBreaks:=False, SummaryBelowData:=True End Sub HTH, Wouter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Range.Group Method - group rows, not columns | Excel Programming | |||
Group a range - closing the group does not hide the controls.... | Excel Programming | |||
Sort by Group Header or by Group SubHeader | Excel Programming | |||
Taking age group Ie ages 20-29 and picking out net sales for group | Excel Worksheet Functions | |||
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee | Excel Worksheet Functions |