Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I macro sort with a varaible range (differing last cell)?
I need to sort from A3 to J100, for example, now. Later, it could be from A3
to J207. There usually are blank columns also (the LIST command didn't like that). |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I macro sort with a varaible range (differing last cell)?
Can you pick out a column that always has data in it if that row is used?
Maybe... Dim LastRow as long with worksheets("somesheetname") lastrow = .cells(.rows.count,"A").end(xlup).row .range("a3:J" & lastrow).sort ...rest of sort parms here... End with sutibusan wrote: I need to sort from A3 to J100, for example, now. Later, it could be from A3 to J207. There usually are blank columns also (the LIST command didn't like that). -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I macro sort with a varaible range (differing last cell)?
hi
find the last row. dim r as range lr = cells(Rows.Count, "A").End(xlUp).Row set r = range("A3:J" & lr) r.Sort Key1:=Range("A3"), _ 'or what you have Order1:=xlAscending, _ Header:=xlGuess, _ OrderCustom:=1, _ MatchCase:=False, _ Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal regards FSt1 "sutibusan" wrote: I need to sort from A3 to J100, for example, now. Later, it could be from A3 to J207. There usually are blank columns also (the LIST command didn't like that). |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to sort variable data range fails | Excel Discussion (Misc queries) | |||
Sorting by rows with differing numbers of cell entries | Excel Discussion (Misc queries) | |||
Macro to Sort A-Z a variable range of cells | Excel Discussion (Misc queries) | |||
Hyperlink varaible substitution - How To | Excel Worksheet Functions | |||
macro code to sort a range | Excel Discussion (Misc queries) |