how do I sort multiple rows in excel

J

jsmith@nisltd

I have a spreadsheet with 7 columns wide with a large number of rows and I
need to sort the data in the rows. I can do it for each individual row but,
this time consuming and could do with knowing if there is any way to sort a
couple of hundred rows.
 
B

Bernie Deitrick

jsmith,

Select all your cells, then run a macro like this, assuming you want each row to be sorted on its
own....

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myRow As Range
For Each myRow In Selection.Rows
myRow.Sort myRow.Cells(1), xlDescending, header:=xlNo, Orientation:=xlSortRows
Next myRow
End Sub
 
D

Dave F

If you have fewer than 255 rows, select everything, copy, paste special,
transpose, to turn your rows into columns.
 
D

Dave F

I vote for Bernie's suggestion.

Bernie Deitrick said:
jsmith,

Select all your cells, then run a macro like this, assuming you want each row to be sorted on its
own....

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myRow As Range
For Each myRow In Selection.Rows
myRow.Sort myRow.Cells(1), xlDescending, header:=xlNo, Orientation:=xlSortRows
Next myRow
End Sub
 
Top