Hello All,
I found the below VBA code on another site that auto sorts the list in a certain Table/Column as you enter data.
It works fine (after renaming the table and column ranges to match my particular spreadsheet.)
However, I have more than one Table/Column I need this code to apply to.
Does anyone have any suggestions for how I can add additional Table/Column ranges to this code?
Thank you very much for any assistance!
I found the below VBA code on another site that auto sorts the list in a certain Table/Column as you enter data.
It works fine (after renaming the table and column ranges to match my particular spreadsheet.)
However, I have more than one Table/Column I need this code to apply to.
Does anyone have any suggestions for how I can add additional Table/Column ranges to this code?
Thank you very much for any assistance!
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim SalesTable As ListObject
Dim SortCol As Range
Set SalesTable = ActiveSheet.ListObjects("Table_Name")
Set SortCol = Range("Table_Name[Column_Name]")
If Not Intersect(Target, SortCol) Is Nothing Then
With SalesTable.Sort
.SortFields.Clear
.SortFields.Add Key:=SortCol, Order:=xlDescending
.Header = xlYes
.Apply
End With
End If
End Sub
Last edited by a moderator: