Thread: Sort array
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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