Right click on the sheet of interest; paste this code into the window that
opens:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row >= 1 Then
Range("A1", Range("A1").End(xlDown)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
End Sub
May need a bit of modifying, btu this should be pretty darn close...
You should disable events within the Change event before making any
changes. Otherwise, the Change event makes a change, that triggers
Change, which makes a change that triggers Change, as so on until you
run out of stack space.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'''
' code
'''
Application.EnableEvents =True
End Sub
Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC www.cpearson.com
(email on web site)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.