Hi.
I have a sheet with a table. I am trying to sort table 'DeviceSummary' using Column 'ID'
Table DeviceSummary:
ID Col2 Col3 Value
1,1 A B 12
1,2 C D 15
etc
I need to sort the table using column ID.
I set up a range defining the criteria to sort on.
Here is my code: (This is pulled from a forum where the user thanked the people that gave this to him saying that it works great.)
I have tweaked things til I am going nuts, and cannot get anywhere.
No matter what I have tried, I keep getting a Run-Time error '438': Object doesn't support this property or method.
Any help is appreciated.
Rich
I have a sheet with a table. I am trying to sort table 'DeviceSummary' using Column 'ID'
Table DeviceSummary:
ID Col2 Col3 Value
1,1 A B 12
1,2 C D 15
etc
I need to sort the table using column ID.
I set up a range defining the criteria to sort on.
Here is my code: (This is pulled from a forum where the user thanked the people that gave this to him saying that it works great.)
I have tweaked things til I am going nuts, and cannot get anywhere.
Code:
ActiveWorkbook.Worksheets("Summary").ListObjects("DeviceSummary").Sort.SortFields.Clear
On Error Resume Next
Application.AddCustomList listArray:=Worksheets("Rates").Range("CustomList") ' My list of sorting instructions
On Error GoTo 0
With ActiveWorkbook.Worksheets("Summary").ListObjects("DeviceSummary").Sort
.SortFields.Clear
.SortFields.Add _
key:=.ListColumns(ID), _
SortOn:=xlSortOnValues, _
Order:=xlAscending, _
CustomOrder:=Worksheets("Rates").Range("CustomList"), _
DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
No matter what I have tried, I keep getting a Run-Time error '438': Object doesn't support this property or method.
Any help is appreciated.
Rich