Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection.Sort error
ActiveSheet.Range("C7").Select ActiveSheet.Range(Selection, Selection.End(xlDown)).Select Selection.Sort Key1:=Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom In the above code, the select statements are working correctly, so the range I want is selected, however I get an error on the Selection.Sort statement every time. Any thoughts? -- Krager ------------------------------------------------------------------------ Krager's Profile: http://www.excelforum.com/member.php...o&userid=20936 View this thread: http://www.excelforum.com/showthread...hreadid=401705 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection.Sort error
Ok fixed my own problem, just added an ActiveSheet. in front of the Range in the selection statement and that solved it. Selection.Sort Key1:=ActiveSheet.Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom -- Krager ------------------------------------------------------------------------ Krager's Profile: http://www.excelforum.com/member.php...o&userid=20936 View this thread: http://www.excelforum.com/showthread...hreadid=401705 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection.Sort error
I tested yours and it worked but you may want to try this instead
Sub sortmyrange() Range("C7", Range("C7").End(xlDown)). _ Sort Key1:=Range("C7"), Order1:=xlAscending End Sub -- Don Guillett SalesAid Software "Krager" wrote in message ... ActiveSheet.Range("C7").Select ActiveSheet.Range(Selection, Selection.End(xlDown)).Select Selection.Sort Key1:=Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom In the above code, the select statements are working correctly, so the range I want is selected, however I get an error on the Selection.Sort statement every time. Any thoughts? -- Krager ------------------------------------------------------------------------ Krager's Profile: http://www.excelforum.com/member.php...o&userid=20936 View this thread: http://www.excelforum.com/showthread...hreadid=401705 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selection.Sort error
What's the text of the error?
Tim "Krager" wrote in message ... ActiveSheet.Range("C7").Select ActiveSheet.Range(Selection, Selection.End(xlDown)).Select Selection.Sort Key1:=Range("C7"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom In the above code, the select statements are working correctly, so the range I want is selected, however I get an error on the Selection.Sort statement every time. Any thoughts? -- Krager ------------------------------------------------------------------------ Krager's Profile: http://www.excelforum.com/member.php...o&userid=20936 View this thread: http://www.excelforum.com/showthread...hreadid=401705 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorting Spreadsheet Selection - Recurring Sort | Excel Worksheet Functions | |||
How can I sort a selection of cells into random order? | Excel Discussion (Misc queries) | |||
Macro - Data Sort -Variable Selection | Excel Discussion (Misc queries) | |||
Selection.Sort not working? | Excel Programming | |||
Need a macro for selection and sort | Excel Programming |