Home » KBArticles » Excel Auto sorting Macro

Excel Auto sorting Macro

Copy of the macro I used in my autosort Spreadsheet

Private Sub Worksheet_Change(ByVal Target As Range)

If Not (Application.Intersect(Worksheets(1).Range(“A150:H180”), Target) Is Nothing) Then
DoSort
End If
End Sub

Private Sub DoSort()
Sheet1.Range(“A150:H180”).Sort Key1:=Sheet1.Range(“A1”), Order1:=xlAscending, _
Key2:=Sheet1.Range(“D1”), Order2:=xlDescending

End Sub

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.