Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting
Hi,
Is there a way to sort a list by the last 2 letters of a word in VBA? Thank you, LC |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting
One way:
In a blank column (say D), enter: D2: =RIGHT(A2,2) and copy down. Then sort on that column, which can be hidden if you wish. In article , "LC" wrote: Hi, Is there a way to sort a list by the last 2 letters of a word in VBA? Thank you, LC |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting
Whoops- didn't see the VBA (which I should have, given the group,
sorry!): Same answer, but using VBA to populate the column: Public Sub SortLastTwo() Dim rng As Range Set rng = Range("D2:D" & _ Range("A" & Rows.Count).End(xlUp).Row) With rng .Value = "=RIGHT(A2,2)" .Item(1).Sort Key1:=.Item(1), Header:=True .Clear End With End Sub In article , "J.E. McGimpsey" wrote: One way: In a blank column (say D), enter: D2: =RIGHT(A2,2) and copy down. Then sort on that column, which can be hidden if you wish. In article , "LC" wrote: Hi, Is there a way to sort a list by the last 2 letters of a word in VBA? Thank you, LC |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorting Values Without Sorting Formulas | Excel Discussion (Misc queries) | |||
Automatic sorting (giving max and min) based on custom sorting lis | Excel Worksheet Functions | |||
Sorting VLookup vs Sorting SumProduct | Excel Discussion (Misc queries) | |||
Sorting: Sorting by the First Character | Excel Discussion (Misc queries) | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |