ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatically Sort colums (https://www.excelbanter.com/excel-discussion-misc-queries/18417-automatically-sort-colums.html)

tamato43

Automatically Sort colums
 
Is there a way to format cells or columns to automatically re-sort?

I'm importing infomation from another file and I'd like to sort from Hich to
low as the numbers change.

RagDyeR

If your numbers where being entered into Column A,
this formula would *automatically* display them in ascending order in
whichever column you used the formula in:

=SMALL($A$1:$A$100,ROW(A1))

And copy down as needed.
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"tamato43" wrote in message
...
Is there a way to format cells or columns to automatically re-sort?

I'm importing infomation from another file and I'd like to sort from Hich to
low as the numbers change.



Gareth Roberts

You could trap every change made on the worksheet and sort each time. Place
the following code in the worksheet module for the sheet into which you will
import your data

Private Sub Worksheet_Change(ByVal Target As Range)

'sorts ascending for Column 1 and Column 2
Me.UsedRange.Sort Key1:=Me.Range(Cells(1, 1).Address),
Order1:=xlAscending, _
Key2:=Me.Range(Cells(1, 2).Address),
Order2:=xlAscending, _
Header:=xlYes

End Sub

Note this sorts every time you change any cell on the worksheet so you may
like to refine it to only work on certain columns.

HTH,
Gareth


"tamato43" wrote in message
...
Is there a way to format cells or columns to automatically re-sort?

I'm importing infomation from another file and I'd like to sort from Hich

to
low as the numbers change.





All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com