Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Sorts
Hello,
Is there a better way to write the below code? I have 26 Columns of data, which I want the data within each column to be sorted when the User clicks a command button. Sub Sort_CounselorNames(sht As Worksheet, pwd As String) ' Unprotect Worksheet sht.Unprotect Password:=pwd With ActiveSheet .Range("B8:B37").Sort Key1:=.Range("B8:B37"), _ Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom .Range("C8:C37").Sort Key1:=.Range("C8:C37"), _ Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom .Range("D8:D37").Sort Key1:=.Range("D8:D37"), _ Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom .Range("E8:E37").Sort Key1:=.Range("E8:E37"), _ Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom .Range("F8:F37").Sort Key1:=.Range("F8:F37"), _ Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End With Range("B8").Select ' Protect Worksheet sht.Protect Password:=pwd, Scenarios:=True End Sub Thanks Ruan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum by different sorts | Excel Discussion (Misc queries) | |||
Sorts | Excel Worksheet Functions | |||
same range, multiple sheets, different sorts, help please! | Excel Worksheet Functions | |||
Excel gets subtotals out of order using multiple sorts and subtot. | Excel Discussion (Misc queries) | |||
Macro for Multiple Sorts | Excel Programming |