Sorting Question

  • Thread starter Thread starter DavidWilson
  • Start date Start date
D

DavidWilson

Hi

I hope someone can answer my question.
I understand how to sort a list, however I was just wondering whether you
CAN get Excel to automatically resort a list when you make changes. I have
got a list of times (Column B) associated with certain runners (Column A).
When I change one of the times, I would like the list to resort itself. Can
Excel do this or not.

Any ideas.

Thanks
 
You could do it, but maybe just recording a macro (while you do it once
manually) and then replaying that macro would suffice.

It would irritate the heck out of me if I changed a value in one cell and
arrowed over to the next cell and found I wasn't on the correct row any more.

But as an automatic macro:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("b2:b" & Me.Rows.Count)) Is Nothing Then
Exit Sub
End If

With Me.Range("a:b")
.Sort key1:=.Columns(2), order1:=xlAscending, header:=xlYes
End With
End Sub


Rightclick on the worksheet tab that should have this behavior and select view
code. Then paste this into the codewindow.

Then back to excel and test it out.

I assumed that you had one row of headers.
 
You could record a macro doing the sort you require, and then place a button
next to the list associated to that macro, and press the button whenever you
update a time.

HTH Chloe
 
Back
Top