View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Setting a spreadsheet to auto sort data entry

Say your data is in columns A & B. Whenever you update a record in column A
(manually), we want column A & B to re-sort automatically. Assume there is a
header row in row #1. Enter the following event code in the worksheet code
area:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A:A"), Target) Is Nothing Then Exit Sub
n = Cells(Rows.Count, "A").End(xlUp).Row
Application.EnableEvents = False
Range("A1:B" & n).Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Application.EnableEvents = True
End Sub

Naturally, enter data in column B before column A.
--
Gary''s Student - gsnu200787


"Judy Rose" wrote:

Have a spreadsheet that is created each month to track the reappointment
applications for that month, there are 16 various stages the application
could be in and the number 1-16 is entered into column A. I want to be able
to set up the spreadsheet to auto sort based on the entry in Column A upon
update of the value.

Each case starts at 1, depending on its progress through the review process
would dictate the number value beyond 1, each time I update the record to
show progress I want my spreadsheet to automatically resort the rows of data
based on the updated value.

Is this possible.
--
Judy Rose Cohen