ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I prioritize data automatically? (https://www.excelbanter.com/excel-worksheet-functions/246886-how-can-i-prioritize-data-automatically.html)

Sabbjl

How can I prioritize data automatically?
 
I am trying to set up a workbook to automatically move older dated items to
the top of my workbook and possibly shade them.

ryguy7272

How can I prioritize data automatically?
 
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--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Sabbjl" wrote:

I am trying to set up a workbook to automatically move older dated items to
the top of my workbook and possibly shade them.



All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com