Forum Discussion
auburnshell
Jan 25, 2018Copper Contributor
custom sort
Can you set a custom sort to run at save so every time you add new data it automatically sorts? I have a spreadsheet of projects and when a completion date is put in column j, I want that project to...
Haytham Amairah
Jan 25, 2018Silver Contributor
Hi,
Try the solution in the attached file, it's powered by this code:
'Reference: https://www.extendoffice.com/documents/excel/2592-excel-auto-sort-by-value.html
'Updated by Haytham Amairah 1/25/2018
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("A:B")) Is Nothing Then
Range("B1").Sort Key1:=Range("B2"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
On Error GoTo 0
End Sub