Reputation: 63
I know how to sort a range by value. I have this code
Sub calander4()
Range("currentmonth").Sort _
Key1:=Range("currentmonthrating"), Order1:=xlDescending
End Sub
this code sorts range within columns highest to lowest by value. what i want on top of that is to sort the columns them selves left to right by a value. say the second top cell. which i would of course name and make range. is it possible?
Upvotes: 0
Views: 79
Reputation:
You need to specify the Orientation parameter.
Option Explicit
Sub calander5()
With Range("currentmonth")
.Sort Key1:=.Cells(2, 1), Order1:=xlAscending, _
Orientation:=xlSortColumns, Header:=xlNo
End With
End Sub
See Range.Sort Method (Excel) for more.
Upvotes: 1