S
sbitaxi
Hello:
I have been creating a reporting tool, and would like to be able to
sort from a macro using criteria pulled from a cell.
How do I tell Excel to select the Sort Key based on data in another
cell/worksheet. Right now, the script tells it to sort the range by
column B, starting in row 3, ascending order. I'd like to have a drop
down list of the "Fields" aka columns, in another worksheet. The user
selects the field, clicks a button and Excel generates a report. This
will be part of another macro that filters out records and copies them
into a report template.
Range("A1:AC23").Sort Key1:=Range("B3"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Hopefully this is clear.
Steven
I have been creating a reporting tool, and would like to be able to
sort from a macro using criteria pulled from a cell.
How do I tell Excel to select the Sort Key based on data in another
cell/worksheet. Right now, the script tells it to sort the range by
column B, starting in row 3, ascending order. I'd like to have a drop
down list of the "Fields" aka columns, in another worksheet. The user
selects the field, clicks a button and Excel generates a report. This
will be part of another macro that filters out records and copies them
into a report template.
Range("A1:AC23").Sort Key1:=Range("B3"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Hopefully this is clear.
Steven