I have some existing code that will sort a range alphabetically from A - Z:
Code:
Private Sub CommandButton3_Click()
Columns("C:C").Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C1:C30").Select
Selection.Copy
Range("D24").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
However, I'd love to modify this so that the letter P is sorted at the top of the list, followed by M then D, so in a 6 cell list with the following characters in each cell:
D1
M2
P1
P2
M1
D2
It would be sorted to:
P1
P2
M1
M2
D1
D2
How can I modify the first part of the code (not the transpose bit) to accomplish this?
Code:
Private Sub CommandButton3_Click()
Columns("C:C").Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C1:C30").Select
Selection.Copy
Range("D24").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
However, I'd love to modify this so that the letter P is sorted at the top of the list, followed by M then D, so in a 6 cell list with the following characters in each cell:
D1
M2
P1
P2
M1
D2
It would be sorted to:
P1
P2
M1
M2
D1
D2
How can I modify the first part of the code (not the transpose bit) to accomplish this?