Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort array
Hey, I have a large range of cells that I would like to be able to sor descending by one of the columns. Is it possible to do this using vba? I have looked into the bubblesor technique but i can't get it to work and the version that i saw woul sort the whole worksheet rather than a range of cells. Thanks in advance -- sli ----------------------------------------------------------------------- slim's Profile: http://www.excelforum.com/member.php...fo&userid=2864 View this thread: http://www.excelforum.com/showthread.php?threadid=52535 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort array
What's wrong with standard Excel sort (which is usually much quicker than VBA
sorts)? "slim" wrote: Hey, I have a large range of cells that I would like to be able to sort descending by one of the columns. Is it possible to do this using vba? I have looked into the bubblesort technique but i can't get it to work and the version that i saw would sort the whole worksheet rather than a range of cells. Thanks in advance. -- slim ------------------------------------------------------------------------ slim's Profile: http://www.excelforum.com/member.php...o&userid=28643 View this thread: http://www.excelforum.com/showthread...hreadid=525357 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort array
Why not use RangeObj.Sort method to do the sorting? You are not sorting an
array, so I think a custom sort algorithm, like bubble sort, is not relevant in your case. Frederick Chow Hong Kong. "slim" wrote in message ... Hey, I have a large range of cells that I would like to be able to sort descending by one of the columns. Is it possible to do this using vba? I have looked into the bubblesort technique but i can't get it to work and the version that i saw would sort the whole worksheet rather than a range of cells. Thanks in advance. -- slim ------------------------------------------------------------------------ slim's Profile: http://www.excelforum.com/member.php...o&userid=28643 View this thread: http://www.excelforum.com/showthread...hreadid=525357 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort array
Hey, thanks for replying. I've solved the problem now with a handy bit of code from Microsoft! Sub SortRange() Dim MyErr As Label On Error GoTo MyErr Selection.Sort Key1:=Range("N5"), Order1:=xlAscending Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom MyErr: Select Case Err Case 0 'Everything is OK Case Else MsgBox Err.Description End Select Err.Clear End Sub Thanks for your help -- sli ----------------------------------------------------------------------- slim's Profile: http://www.excelforum.com/member.php...fo&userid=2864 View this thread: http://www.excelforum.com/showthread.php?threadid=52535 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort array
Just for interest:
You could have gotten code like that by turning on the macro recorder, selecting your range and do Data=sort and specifying your parameters. Then turn off the macro recorder. -- Regards, Tom Ogilvy "slim" wrote: Hey, thanks for replying. I've solved the problem now with a handy bit of code from Microsoft! Sub SortRange() Dim MyErr As Label On Error GoTo MyErr Selection.Sort Key1:=Range("N5"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom MyErr: Select Case Err Case 0 'Everything is OK Case Else MsgBox Err.Description End Select Err.Clear End Sub Thanks for your help. -- slim ------------------------------------------------------------------------ slim's Profile: http://www.excelforum.com/member.php...o&userid=28643 View this thread: http://www.excelforum.com/showthread...hreadid=525357 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sort an array | Excel Programming | |||
sort 2D array | Excel Programming | |||
sort 2D array | Excel Programming | |||
sort an array | Excel Programming | |||
Sort an Array | Excel Programming |