View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default automatically sorting a simple list

Right-click on w/sheet tab (where your data is) "View code", and copy/paste
code below. If Column B .. no check for rows ...is changed, it sorts (by
column B) values.

HTH



Sub Worksheet_Change(ByVal target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False

If target.Column < 2 Then Exit Sub

Columns("A:B").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ws_exit:
Application.EnableEvents = True

End Sub

"cbguy" wrote:

This seems like it should be simple, but I'm not having luck figuring out how
to do it. Any help would be appreciated. I have a simple list of 10 things
each with a value associated with it. As the values change, I'd like the
list to automatically resort itself in ascending order. I don't want to have
to go and highlight the two columns and use the sort command every time I
change one of the values. This should be easy right??? help.
--
Thanks, CBguy