I am trying to sort data as descending by row but to respect the names of the columns to show first the column with the highest value in the first month, and so on with all the lines of the month. I know that the first one prevails. It is what is done manually choosing the option to sort from left to right and sorting by rows in excel.
This code (which is not mine) does it but totally ignores the columns, it only listens to the lines and mixes the data of all the columns. Can someone help me please? Thanks in advance.
I would prefer in vba excel, but if someone knows how to do it in sas, it also works for me. Thanks
Sub Macro1()
'
' Macro1 Macro
' Keyboard Shortcut: Ctrl+Shift+S
'
Range("d2:g2").Select
Selection.Sort Key1:=Range("d2"), Order1:=xlAscending, Header:=c1 _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal
Range("d3:g3").Select
Selection.Sort Key1:=Range("d3"), Order1:=xlAscending, Header:=c1 _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal
Range("d4:g4").Select
Selection.Sort Key1:=Range("d4"), Order1:=xlAscending, Header:=c1 _
, OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal
End Sub