Howdy,
I have this code here that automatically sorts my "Priority" column when a value is changed. I would like it to sort the priority column first and then do a secondary sort by "Due Date." I have fiddled around with it quite a bit and I can't seem to get it to work. Any help is appreciated. Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SalesTable As ListObject
Dim SortCol As Range
Set SalesTable = ActiveSheet.ListObjects("ToDo_List")
Set SortCol = Range("ToDo_List[Priority]")
If Not Intersect(Target, SortCol) Is Nothing Then
With SalesTable.sort
.SortFields.Clear
.SortFields.Add Key:=SortCol, Order:=xlAscending, CustomOrder:="High,Medium,Low"
.Header = xlYes
.Apply
End With
End If
End Sub
I have this code here that automatically sorts my "Priority" column when a value is changed. I would like it to sort the priority column first and then do a secondary sort by "Due Date." I have fiddled around with it quite a bit and I can't seem to get it to work. Any help is appreciated. Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SalesTable As ListObject
Dim SortCol As Range
Set SalesTable = ActiveSheet.ListObjects("ToDo_List")
Set SortCol = Range("ToDo_List[Priority]")
If Not Intersect(Target, SortCol) Is Nothing Then
With SalesTable.sort
.SortFields.Clear
.SortFields.Add Key:=SortCol, Order:=xlAscending, CustomOrder:="High,Medium,Low"
.Header = xlYes
.Apply
End With
End If
End Sub