View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Romileyrunner1 Romileyrunner1 is offline
external usenet poster
 
Posts: 73
Default sorting using letters , but not alphabetically.

Fantastic work LUKE M.
Made my day that has fella.
Thanks a lot.
RR1

"Luke M" wrote:

Under Tools-Options - Lists, you can create a Custom List telling XL how you
want certain things ordered. This will create a custom list.

Then, if you were to go to Data - Sort, under Options, you can choose which
custom list you want to sort by. In VB, this will end up looking something
like this:

Selection.Sort Key1:=Range("C12"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

The key part is "OrderCustom:=6" as this is saying to use the 6th Custom
List. You will need to modify this to fit your actual settings.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Romileyrunner1" wrote:

Hi I want write a macro to sort a spreadsheet with the rows being ordered
from a particular collumn which contain the following letters: W, SA, SA+, ST
and blank cells. I need the rows to be sorted in that order from top to
bottom. I.E. a;; the `W` rows first, all the ` SA` rows next etc.

Now, I know I could create a collumn next to it with perhaps a vlookup
reference of say W=1. SA =2 etc, and then sort on that instead, but belive it
or not, I`m almost out of collumns (it`s a big spreadsheet) and also some of
my other refences might be affected if I go and plonk another collumn in now.
Any ideas?
Thanks guys
RR1