Hi,
I'm trying to create a code whereby when a user updates one of many tables that are found in the 'Tables' sheet, the relevant table automatically sorts once a cell is updated.
The code below is working fine, however, i would like to also automatically change the sort key from "A1", to reflect the correct sort key of the table that the user selected. For eg. if the user is updating the content of a table found in column "J", I would like the "Sort key1:=Range" to automatically reflect "J1" in my code.
Below is my code:
Sub Auto_Open()
ThisWorkbook.Worksheets("Tables").OnEntry = "SortLists"
End Sub
-------------------------------------------------------------
Sub sortlists()
Dim currcell As Range
Set currcell = Application.Caller
Selection.Sort key1:=Range("A1"), _
order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
regards,
Bookmarks