How can I prioritize data automatically?

  • Thread starter Thread starter Sabbjl
  • Start date Start date
S

Sabbjl

I am trying to set up a workbook to automatically move older dated items to
the top of my workbook and possibly shade them.
 
This tiny macro will auto-sort data in Column C, as well as all data in the
same row in Column A and Column B.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim EndData As Long

If Target.Column <> 3 Then Exit Sub 'Sort is done based on data in
Column C, which is the third column

Application.ScreenUpdating = False

EndData = Cells(Rows.Count, 1).End(xlUp).Row

With Range(Cells(3, 1), Cells(EndData, 3)) 'Sort is done based on data
in Column C, which is the third column
.Sort Key1:=Range("C2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With

Application.ScreenUpdating = False
End Sub

HTH,
Ryan--
 
Back
Top