ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to sort right to left (https://www.excelbanter.com/excel-discussion-misc-queries/226511-macro-sort-right-left.html)

Steve

macro to sort right to left
 
Help please!

I need a macro to sort numbers left-to-right in cells C2 to G2

these numbers continue down the columns for about 600

I can't get the macro I need to move down a sort each row in turn.

Thanks in advance

Steve

Bernie Deitrick

macro to sort right to left
 
Steve,

You may need to change xlAscending to xlDescending:

Sub SteveSort()
Dim myC As Range

For Each myC In Range(Range("C2"), Cells(Rows.Count, 3).End(xlUp))
myC.Resize(1, 5).Sort Key1:=myC, _
Order1:=xlAscending, Orientation:=xlLeftToRight
Next myC
End Dub

HTH,
Bernie
MS Excel MVP



"Steve" wrote in message ...
Help please!

I need a macro to sort numbers left-to-right in cells C2 to G2

these numbers continue down the columns for about 600

I can't get the macro I need to move down a sort each row in turn.

Thanks in advance

Steve



All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com