B
bw
How do I change the following code to sort by a parameter SortCol1 and SortCol2, which
contains the column identifiers by which I want to sort? For example, SortCol1 = 3 (or
"C" if if would be better), SortCol2 = 1 (or "A" if if would be better)...
Cells.Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Thanks,
Bernie
contains the column identifiers by which I want to sort? For example, SortCol1 = 3 (or
"C" if if would be better), SortCol2 = 1 (or "A" if if would be better)...
Cells.Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Thanks,
Bernie