Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Sort
I want to sort a section of a spreadsheet -
I make a selection (say range("A22:D27") I then want to sort that selection on column c then column d when I recorded the macro this is what I got: Range("A22:D27").Select Selection.Sort Key1:=Range("C22"), Order1:=xlAscending, Key2:=Range("D22" _ ), Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False _ , Orientation:=xlTopToBottom The problem is that the range is hard coded with "C22" - I want a variable so I can select a range and then sort by column c then column d How can I capture the top row number of the range so I can have this as a dynamic macro? Glen |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Updating workbook with an alpha sort sheet and a numeric sort shee | Excel Discussion (Misc queries) | |||
Sort by color: Is there an easy way to sort columns or rows in EX | Excel Worksheet Functions | |||
sort function for dates does not sort properly in Office 2007 Exc. | Excel Worksheet Functions | |||
Excel sort by Fill Color by custom list sort | Excel Discussion (Misc queries) | |||
Excel Sort function should not sort the cell formatting! | Excel Worksheet Functions |