Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the reply p45cal,
I had just worked out doing it this way ... Range("E3:G3").End(xlDown).Sort _ Key1:=Range("G3"), Order1:=xlDescending, _ Key2:=Range("E3"), Order2:=xlAscending, _ Key3:=Range("F3"), Order3:=xlAscending .... and ... Range("I3:L3").End(xlDown).Sort _ Key1:=Range("L3"), Order1:=xlDescending, _ Key2:=Range("I3"), Order2:=xlAscending, _ Key3:=Range("J3"), Order3:=xlAscending .... are you saying that this is NOT the optimum way to do it?. Thanks in Advance. All the Best. Paul On Aug 31, 11:19 am, "Robert McCurdy" wrote: A few questions: Does your table have headers in row 2? Is your table clear of internal blank rows? Are there other tables or data below your desired sortable range/table? Assuming the answers are, Yes, Yes, No (as it should), then: Sub Dsort() Dim SortRng As Range Set SortRng = Range("E2:G" & Rows.Count) SortRng.Sort Key1:=Range("G2"), Order1:=xlDescending, Header:=xlYes, _ Key2:=Range("E2"), Order2:=xlAscending, Header:=xlYes, _ Key3:=Range("F2"), Order3:=xlAscending, Header:=xlYes End Sub Regards Robert McCurdy"Paul Black" wrote in ooglegroups.com... Hi everyone, I have a program that outputs columns of values to a worksheet. I have titles in row 2 and the values start in columns "E3:G?", "I3:L?" etc. I would like to sort the values but I don't know what the last row will be. Here is an example for columns "E3:G?" ... Range("E3:G?").Select Selection.Sort Key1:=Range("G3"), Order1:=xlDescending, Key2:=Range("E3") _ , Order2:=xlAscending, Key3:=Range("F3"), Order3:=xlAscending ... with the ? is the unknown number to sort down to. Thanks in Advance. All the Best. Paul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Knowing the number | Excel Discussion (Misc queries) | |||
Identifying value in a cell knowing R1C1 naming | Excel Programming | |||
Knowing when Solver closes | Excel Programming | |||
getting a y-value from a graph knowing the corresponding x-value | Excel Discussion (Misc queries) | |||
Select from first worksheet without knowing it's name | Excel Programming |