Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get an error on the Rows.Count line because I don't know how/what to select
for the range to sort on. Does it have to select the entire worksheet cells in order to sort on the 3 keys or does it just need the top to bottom range of 1 of the columns? Right now I selected the A1: There are just 3 keys to sort on, Q1, S1, & A1 are the header fields. The first two are ID numbers and A1 is alpha sort. This macro isn't sorting. THANKS, Sub Sort() ' ' Sorts by Item Name, Dept, Status# Macro Dim rng As Range ' sorts on Dept, & Status since there is only 3 keys available in a sort With ActiveSheet Set rng = .Range(.Cells(1, 1), .Cells(27, 1)) (Rows.Count, "A").End(xlUp) rng.Sort key1:=Cells(17, 2), Order1:=xlAscending, _ key2:=Cells(19, 2), Order2:=xlDescending, _ key3:=Cells(1, 2), Order3:=xlAscending, Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Prevent SORT from asking to expand selection in Excel 2007? | Excel Discussion (Misc queries) | |||
How do you do a range selection dialog like those many in Excel? | Excel Discussion (Misc queries) | |||
Excel 2007 Range Selection | Excel Discussion (Misc queries) | |||
excel change default column sort to current selection | Excel Worksheet Functions | |||
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. | Excel Programming |