Hello Excel savants,
I am trying to get a table to sort by "Start Date" first, then sort by "Start Time". I have a macro that sorts by the date working, but would like to sort items on the same date by start time. Is that possible?
I am trying to get a table to sort by "Start Date" first, then sort by "Start Time". I have a macro that sorts by the date working, but would like to sort items on the same date by start time. Is that possible?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SalesTable As ListObject
Dim SortCol As Range
Set SalesTable = ActiveSheet.ListObjects("Table7")
Set SortCol = Range("Table7[Start Date]")
If Not Intersect(Target, SortCol) Is Nothing Then
With SalesTable.Sort
.SortFields.Clear
.SortFields.Add Key:=SortCol, Order:=xlAscending
.Header = xlYes
.Apply
End With
End If
End Sub