![]() |
|
#1
|
|||
|
|||
|
It would be much appreciated if someone could help modify this code to sort by the last four characters. Cells in the range contain entries of this format: N12345-12-A-1234. I need the code to sort by the last four numbers.
Again - appreciate any help. Code:
Private Sub CommandButton23_Click()
Range("B3:AA39").Select
ActiveWorkbook.Worksheets("Current Status of CORs").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Current Status of CORs").Sort.SortFields.Add Key:= _
Range("G4:G39"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Current Status of CORs").Sort
.SetRange Range("B3:AA39")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| custom sort macro | ewso | Excel Programming | 7 | 10-10-2017 12:08 PM |
| Modify recorded macro to run until end of document | peter961 | Word VBA | 1 | 09-04-2017 02:50 PM |
how modify a macro code
|
tarikov2006 | Excel Programming | 1 | 11-18-2016 04:10 AM |
Macro to sort columns
|
SerenityNetworks | Excel Programming | 4 | 09-02-2016 06:20 AM |
Sort strings by number of characters
|
reneforster | Word VBA | 1 | 12-04-2014 07:25 AM |