Reputation: 13
I am using the below code where once I select someone in the "Associate" column the table automatically sorts the data.
It takes me back to the top of the table.
I have to scroll back down.
I would like to stay on the row I just completed.
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Sheets("Log").ListObjects("Table1").Sort.SortFields.Clear
ThisWorkbook.Sheets("Log").ListObjects("Table1").Sort.SortFields. _
Add Key:=Range("Table1[[#ALL],[Date]]"), SortOn:=xlSortOnValues, Order _
:=xlAscending, DataOption:=xlSortNormal
ThisWorkbook.Sheets("Log").ListObjects("Table1").Sort.SortFields. _
Add Key:=Range("Table1[[#All],[Time]]"), SortOn:=xlSortOnValues, Order _
:=xlAscending, DataOption:=xlSortNormal
If Not Intersect(Target, Range("Table1[[#All],[Associate]]")) Is Nothing Then
With ThisWorkbook.Sheets("Log").ListObjects("Table1").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
End Sub
Upvotes: 0
Views: 81