Automatic Sorting?
Ted
I do not recommend auto-sorting upon entry.
Once your list gets longer, it is very difficult to find and fix any data
entry mistakes.
I like to confirm first that correct data has been entered then do the sort.
Gord Dibben MS Excel MVP
On Sun, 10 Jan 2010 10:58:51 -0600, "Ted" wrote:
Otto;
Thank you for your reply and your help. Your macro seems to work great.
Though what I meant by "automatically" was I was hoping to have the sort
perform by itself any time the data are revised or changed, without me
having to do anything.
Regards,
-Ted
=========
"Otto Moehrbach" wrote in message
...
Ted
I don't know what you mean by "automatically", but the following little
macro will sort what you want, regardless of how many rows you have. Note
that this macro is written for data as you stated, that is, starts in row
3 (ignoring headers), and is in columns A:W. Also note that your data
must not have any entries in Column A below your data. The macro, as
written, assumes that all data from A3 to the last entry in Column A is to
be sorted. HTH Otto
Sub SortAll()
Dim rColA As Range
Set rColA = Range("A3", Range("A" & Rows.Count).End(xlUp)).Resize(, 23)
rColA.Sort Key1:=Range("F3"), Order1:=xlAscending, _
Key2:=Range("B3"), Order2:=xlAscending, _
Key3:=Range("A3"), Order3:=xlAscending, _
Header:=xlNo, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
End Sub
"Ted" wrote in message
...
I have a worksheet.
Row 1 contains column headers
Row 2 is blank
Rows 3 through row 548 contain data in columns A through W
First sort condition: Column F, smallest to largest
Second sort condition: Column B, smallest to largest
Third sort condition: Column A, smallest to largest
The number of data rows changes constantly - can range from 300 to 600
(or more) rows.
How can I sort the data automatically?
Thank you,
|