#1
|
|||
|
|||
VBA Sort Custom Order
Trying to sort ALL data automatically...sort if something is entered in Column B or C...headers in row 1...first sort based upon Column C (dates) in descending order. That all seems to be working.
What seems to not be working is the fact that I want it also to sort based upon values in Column B; after it sorts based upon Column C. The values in Column B is either 1, 2, or 3. But, I want the sort order to be "2, 1, 3". HELP! Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) On Error Resume Next If Not Intersect(Target, Range("B:C")) Is Nothing Then Range("C1").Sort Key1:=Range("C2"), Order1:=xlDescending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ Key2:=Range("B2"), Order2:=xlDescending, Header:=xlYes, OrderCustom:="2, 1, 3", MatchCase:=False, Orientation:=xlTopToBottom End If End Sub |
#2
|
||||
|
||||
I don't recommend that you use my workaround. Much better that you keep trying until you get this OrderCustom thingy to work, or that someone here explain it to you. But I've never needed to use it; consequently I can't be the one to help. So if no one here answers, and you can't figure it out yourself, it is possible if you're desperate to do this:
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom sort - two header_lines? | Officer_Bierschnitt | Excel | 1 | 11-19-2015 07:48 AM |
Selecting values from different rows in a table and sort them in order in a single row | FromF | Excel | 2 | 09-09-2014 02:30 AM |
How to sort word text in alphabetic order . | crossing | Word | 8 | 01-20-2012 09:51 AM |
Outlook 2007 Contacts Sort Order | bianson | Outlook | 2 | 01-27-2011 10:32 AM |
list of documents come up in random order - any ideas how to sort this? | tallscot49 | Word | 0 | 07-18-2010 12:40 AM |