View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
IdiotZ42 IdiotZ42 is offline
external usenet poster
 
Posts: 6
Default Macro for Special Sorting

depending on the size of your spread sheet code to do this would run quite a
long time.

For the most efficent method that i know of try inserting a new column to
the left of the two columns holding these file names.

now using the new column set a range variable to be from the first row of
data to the last row of data.

then on that range set the .formula = "=IF(b2c2,b2,c2)" for ascending or
"=IF(b2<c2,b2,c2)" for descending

sort by the whole table by the new colum, and delete the column after the
sort...

FYI: excel 03's sort is non-stable, meaning if two rows have the same value
they can endup in any order...

"K" wrote:

I have file names listed in column A and B like (see below)

A B€¦€¦col
Jim Boot - data.xls John Wood (Record List).xlsx
Ali Khan (data).xlsm Dean Wild - system.xls
Bob Will.xlsx Jim Boot (actuals).xlsm
John Wood.xls Kam Finch.xlsx
Ali Khan (Recorded data).xls

The special thing about file names listed in column A and B is that
the first two words in those are always the first name and last name
of the person. I am looking for a macro which should sort both these
columns lists alphabatically and also the way that same name should
come in same row. so i am looking for the result something like (see
below)

A B€¦€¦col
Ali Khan (data).xlsm Ali Khan (Recorded data).xls
Bob Will.xlsx
Dean Wild - system.xls
Jim Boot - data.xls Jim Boot (actuals).xlsm
John Wood.xls John Wood (Record List).xlsx
Kam Finch.xlsx

I'll be very thankful if any friend got sultion for this kind of
sorting.
.