mariposa
New Member
- Joined
- Sep 14, 2016
- Messages
- 14
I can get my table to auto-sort perfectly upon changes in ascending or descending order using the following code:
However, I need it in a custom order, so I have tried the following (along with many others ways, but these were the shortest) but cannot get it to work.
Help please and thank you in advance.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("E:E")) Is Nothing Then
Range("E8").Sort Key1:=Range("E9"), _
Order1:=xlAscending, Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End If
End Sub
Help please and thank you in advance.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("E:E")) Is Nothing Then
Range("E8").Sort Key1:=Range("E9"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="DM,CM,Admin/Clerk,Maint", _
DataOption:=xlSortNormal, Orientation:=xlTopToBottom
End If
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("E:E")) Is Nothing Then
Range("E8").Sort Key1:=Range("E9"), _
Order:=xlAscending, CustomOrder:="DM,CM,Admin/Clerk,Maint", _
OrderCustom:=1, DataOption:=xlSortNormal, Orientation:=xlTopToBottom
End If
End Sub