Sorting Rows of Numbers

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Im trying to sort several hundred rows of numbers from
left to right. eg.

sort - 8 6 7 9 4 10 5 to - 4 5 6 7 8 9 10

Each individual number in its own column.

You can easily sort each individual row one at a time! but
not all at once :(

Any ideas how to do this??
 
Hi Kevin
what Excel version are you using (as in Excel 2003 you can sort
multiple rows at once)
 
Try the Sub sortEachRow() reproduced below
from Dave M's page at:
http://www.mvps.org/dmcritchie/excel/sorting.htm

Scroll down and look for the heading:
Sorting a selection by Rows, with each Row being
independent of the other rows

-------
Sub sortEachRow()
'based on Tom Ogilvy, 2001-03-24, Programming
Dim rw As Range
If Selection.Columns.Count = 1 Then
MsgBox "your selection must involve more" _
& " than one cell or column"
Exit Sub
End If
For Each rw In Selection.Rows
rw.Sort key1:=rw, Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlLeftToRight
Next
End Sub
 
Also 97 and 2002

Select all columns and Data>Sort>Options "left to right"

Gord Dibben Excel MVP
 
Back
Top