View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Custom VBA Function to sort an array of values.

Bob,

Unless there is a particular reason for it you don't need a macro it can be
done with a custom list. Try this

Tools|Options|Custom Lists and type

UK*
FRE*
GER

In the right hand pane and click ADD

Then select your list and
Data|Sort|Options
Select your custom list click OK and sort ascending or descending

Mike

"Bob 187" wrote:

Hi All,

I want to write a custom function that gives me an array of sorted values
based on a list of strings.

1 UKPOW
1 GERPOW
4 FREPOW
2 FREPOW
1 FREPOW
3 GERPOW
2 UKPOW
3 FREPOW
2 GERPOW

I want the function to sort into this order...

1 UKPOW
2 UKPOW
1 FREPOW
2 FREPOW
3 FREPOW
4 FREPOW
1 GERPOW
2 GERPOW
3 GERPOW

Also, there may be blank cells within the array, and I want to omit these
from the sort. Can anyone help please?

Thanks in advance!

Bob