Keeping an Excel list sorted

  • Thread starter Thread starter ben.lopresti
  • Start date Start date
B

ben.lopresti

I am trying to make a list that has 4 columns, one of which is a date
(that is continually updated because it is a "last time contacted"
date).

I would like to have it so that the list is continually updating and
every time I change the date on one of the rows, it is automatically
sorted without me having to click sort every time.

Anyone know how to make this happen?

Thanks.

Ben
 
Here's a Change-event macro that should re-sort your data based on a change
in a cell in Column A..........

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Macro will re-sort column A on any change to a cell in column A
ActiveCell.Select
If ActiveCell.Column = 1 Then 'Limits macro action to column A
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Else
End If
End Sub

hth
Vaya con Dios,
Chuck, CABGx3
 
Thank you very much for the reply, but I am a little unsure what a lot
of it means. Can you break it down in laymans terms how to go about
making an automatically sorting list? Thanks a lot.
-Ben
 
Copy the code from the post, then right-click on the tab of the sheet you
want the macro to be active on and select ViewCode from the dropdown. Then
paste the macro into the large window on the right. From then on it should
work automatically.....anytime there is any change to a cell in column A, the
macro will fire and sort column A, ascending.

Vaya con Dios,
Chuck, CABGx3


Thank you very much for the reply, but I am a little unsure what a lot
of it means. Can you break it down in laymans terms how to go about
making an automatically sorting list? Thanks a lot.
-Ben



Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Macro will re-sort column A on any change to a cell in column A
ActiveCell.Select
If ActiveCell.Column = 1 Then 'Limits macro action to column A
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Else
End If
End Sub
 
Back
Top