View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Automatic Sorting?

turn on the macro recorder, then do a manual sort.

Turn off the macro recorder.

This will show you the code you need to do the sort.

put this code in the worksheet change event and put in a condition that
"target" is in the range you want sorted.

for example:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Columns(1)) Is Nothing Then
Range("A1").Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
End Sub


--
Regards,
Tom Ogilvy


"Scott B. Hogle" wrote in message
...
Is there a way that Excel can automatically sort a column?

I am working on a spreadsheet where the end user "cut and
pastes" data from an outside source to Excel. The Excel
spreadsheet then manipulates the data and creates a one
page presentation piece.

One of the features on the presentation piece is a "Top
10 Client" listing - this is why I want automatic sorting.

I know how to sort the data manually, using the Data -
Sort technique, but I was hoping I wouldn't have to train
the end users how to perform that step.

Any ideas?

Thanks in advance for your help.


Scott B. Hogle