Hello,
I am looking to have two sorting done with my code. First order is from Custom List and the 2nd order is Smallest to Largest.
Here is my code:
The result of the Code does not sort the way i wanted to be.
I want the result of the sorting to be as following:
<tbody>
</tbody>
Any help from your expertise is much appreciated...thank you
I am looking to have two sorting done with my code. First order is from Custom List and the 2nd order is Smallest to Largest.
Here is my code:
Code:
Dim sStatus As Range
Dim sVarValue As Range
Application.AddCustomList ListArray:=Array("0 Count","Shortage","Overage")
Set sStatus = Rows(1).Find("Status")
Set sVarValue=Rows(1).Find("Variance $")
ActiveSheet.Sort.SortFields.Clear
Range("A1").CurrentRegion.Resize(Range("A1").CurrentRegion.Rows.Count - 1).Sort Key1:=sStatus, Order1:=xlAscending, Ordercustom:=Application.CustomListCount, _
Key2:=sVarValue, Order2:=xlAscending, Header:=xlYes, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
The result of the Code does not sort the way i wanted to be.
I want the result of the sorting to be as following:
Variance $ | Status |
(8000) | 0 Count |
(5000) | 0 Count |
(4000) | 0 Count |
(1200) | Shortage |
1000 | Overage |
1200 | Overage |
<tbody>
</tbody>
Any help from your expertise is much appreciated...thank you
Last edited: