Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I alternate a sort from a text box via macros?
I have a column of data that I am using a text box to run a macro that sorts
the data in descending order. How can I alternate the sort criteria (ascending/descending) using the same text box? Push once - sort in ascending order; push again - sort in descending order. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I alternate a sort from a text box via macros?
Here's a down and dirty method
Dim x As Long, ordr As Long x = MsgBox("Sort Ascending (Yes), Descending (No)", vbYesNo) If x = 6 Then ' 6 = Yes ordr = 1 ' 1 = ascending Else ordr = 2 ' 2 = descending End If Range("E:E").Sort Key1:=Range("E1"), Order1:=ordr, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom -- steveB Remove "AYN" from email to respond "g.a." wrote in message ... I have a column of data that I am using a text box to run a macro that sorts the data in descending order. How can I alternate the sort criteria (ascending/descending) using the same text box? Push once - sort in ascending order; push again - sort in descending order. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macros Automatically Sort | Excel Worksheet Functions | |||
Excell Dropdown List. Display alternate text than found in list. | Excel Discussion (Misc queries) | |||
Macros and sort function | Excel Worksheet Functions | |||
How do I alternate a sort from a text box via macros? | Excel Programming | |||
Button Code to Alternate Sort Order ? | Excel Programming |