Sorting

J

J.E. McGimpsey

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.
 
J

J.E. McGimpsey

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top