Thread: auto sort
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default auto sort

Hi
Assuming your numbers are in A1 to A7 on Sheet 1. Then put this code in
the code module behind sheet 1:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ChangeCell as Range
Set ChangeCell = Intersect(Target, Range("A1:A7"))
If Not ChangeCell Is Nothing Then
Range("A1:A7").Sort Key1:=Range("A1"), Order1:=xlAscending
End If
End Sub

To get to that code module, click Alt+F11 to open the VB Editor then
double click the reference to Sheet1. Paste in the above code.

regards
Paul


jamex wrote:
Hi all,

Suppose my range A1 to A7 contains following numbers:
before sort After Sort
---------- ----------
7 1
5 2
2 4
8 5
6 6
4 7
1 8
-- If I change 8 as 3 then it should be automatically sorted,
and expected list should be 1 to 7...is it possible?
please.


--
jamex
------------------------------------------------------------------------
jamex's Profile: http://www.excelforum.com/member.php...o&userid=32243
View this thread: http://www.excelforum.com/showthread...hreadid=547434