Hello.
I want to create a sort macro that is dynamic. Today the macro looks like this:
Sub Sort()
Application.ScreenUpdating = False
Range("A6:AL100").Select
Selection.Sort Key1:=Range("B7"), Order1:=xlDescending, Key2:=Range("A7") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
Range("A6").Select
Application.ScreenUpdating = True
End Sub
I want to have the range dynamic so that I can use the same code for several sort criterias?
Like this:
Sub Sort(Column)
Application.ScreenUpdating = False
Range("A6:AL100").Select
Selection.Sort Key1:=Range( Column&"7"), Order1:=xlDescending, Key2:=Range("A7") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
Range("A6").Select
Application.ScreenUpdating = True
End Sub
I guess it is quite easy to create this but I need help from someone more experienced.
/Anders
Bookmarks