duteberta
Board Regular
- Joined
- Jun 14, 2009
- Messages
- 92
- Office Version
- 365
- Platform
- MacOS
I currently have a list that I put numbers on so that it sorts alphabetically.
I would like to get rid of the numbers and it still sorts in exactly that same order- like this...
So I created a new Custom List in my Excel settings as follows...
My problem is that my VBA code below does not sort according to my new custom list.
How do make it sort properly?
I would like to get rid of the numbers and it still sorts in exactly that same order- like this...
So I created a new Custom List in my Excel settings as follows...
My problem is that my VBA code below does not sort according to my new custom list.
How do make it sort properly?
VBA Code:
Sub SortTable()
Dim iSheet As Worksheet
Dim iTable As ListObject
Dim iColumn As Range
Set iSheet = ActiveSheet
Set iTable = iSheet.ListObjects("MASTER")
Set iColumn1 = Range("MASTER[Status]")
Set iColumn2 = Range("MASTER[CloseD]")
Set iColumn3 = Range("MASTER[C1]")
With iTable.Sort
.SortFields.Clear
.SortFields.Add Key:=iColumn1, Order:=xlAscending
.SortFields.Add Key:=iColumn2, Order:=xlDescending
.SortFields.Add Key:=iColumn3, Order:=xlAscending
.Header = xlYes
.Apply
End With
End Sub