Forum Discussion
star_man35
Mar 14, 2022Copper Contributor
Excel 365, sorting rows of a range
I have a range of single digit numbers (please see below) and I want to sort each row Largest to Smallest (i.e., largest digits on the left and in descending order to the right). If I Custom sort eac...
- Mar 14, 2022
If 'row' is a relative reference to a single row, then
= SORT(row,,-1,1)will create a sorted copy of the row which may be filled down to complete the table. To do the same thing with a single formula requires the latest version of 365
= MAKEARRAY(11,6, LAMBDA(r,c, INDEX(SORT(INDEX(data,r,),,-1,1),c) ) )
HansVogelaar
Mar 14, 2022MVP
You could adapt the following macro for your setup:
Sub SortRows()
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
m = Range("A" & Rows.Count).End(xlUp).Row
For r = 1 To m
Range("A" & r).EntireRow.Sort Key1:=Range("A" & r), Order1:=xlDescending, Header:=xlNo, Orientation:=xlSortRows
Next r
Application.ScreenUpdating = True
End Substar_man35
Mar 14, 2022Copper Contributor
Dear Mr. Hans Vogelaar,
Thank you very much for your quick response and for your kind advice. I shall try your micro and revert.
Thanks again
Harry Karanasssos
Thank you very much for your quick response and for your kind advice. I shall try your micro and revert.
Thanks again
Harry Karanasssos