Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default Sorting a column

Hi,

Just wondering what may be the best method to get all cells in one
column into a sorted array.

If I sort the column, it affects the order of the whole sheet, which
isn't wanted.
The only alternative I can think of is a bubble sort of the array,
after asignment. Not very efficient.

Is there a better solution? I'm not too good with ranges, but can you
assign a range, sort it, then read that into an array ?

Thanks - Kirk

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Sorting a column

you can use a helper column off to the right. enter 1 to whatever down the
column, then sort on your column, add to array and resort on the helper
column to put it back in the original order.

--

Gary
Excel 2003


"kirkm" wrote in message ...
Hi,

Just wondering what may be the best method to get all cells in one
column into a sorted array.

If I sort the column, it affects the order of the whole sheet, which
isn't wanted.
The only alternative I can think of is a bubble sort of the array,
after asignment. Not very efficient.

Is there a better solution? I'm not too good with ranges, but can you
assign a range, sort it, then read that into an array ?

Thanks - Kirk


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Sorting a column

Hi,

And, you can load the array in one step

Dim myArray As Variant
myArray = [B1:B100]

Where B1:B100 contains the sorted data for the array

Regarding sorting in the spreadsheet verses bubble sort, it is my
understanding that its faster to do your sorts in the spreadsheet.

--
Thanks,
Shane Devenshire


"kirkm" wrote:

Hi,

Just wondering what may be the best method to get all cells in one
column into a sorted array.

If I sort the column, it affects the order of the whole sheet, which
isn't wanted.
The only alternative I can think of is a bubble sort of the array,
after asignment. Not very efficient.

Is there a better solution? I'm not too good with ranges, but can you
assign a range, sort it, then read that into an array ?

Thanks - Kirk


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting a Pivot Table Column that is not the first column... [email protected] Excel Worksheet Functions 1 October 10th 07 09:02 PM
Column sorting ukyob Excel Discussion (Misc queries) 3 August 3rd 06 07:16 PM
How do I limit sorting a column to the column? Pat Excel Worksheet Functions 0 February 9th 06 04:01 PM
Sorting 1 column into two jimF Excel Discussion (Misc queries) 5 February 1st 06 05:39 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM


All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"