Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Patrick Simonds
 
Posts: n/a
Default Need a sorting solution

I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25



  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Posted in other groups.


--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Patrick Simonds" wrote in message
...
I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the
rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25





  #3   Report Post  
Myrna Larson
 
Posts: n/a
Default

You can do this with formulas involving the SMALL function. If the range is
large, it's quite slow to update.

Some years back I wrote a VBA macro to sort in-place which ran quite fast. You
can find it on Google. Search for SortInPlace (all one word), author Myrna
Larson.

On Tue, 15 Mar 2005 19:44:53 -0800, "Patrick Simonds"
wrote:

I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25



  #4   Report Post  
Rowan
 
Posts: n/a
Default

This macro should do it assuming the acivesheet has your data:

Sub SortIt()

Application.DisplayAlerts = False
Application.ScreenUpdating = False

Dim myRange As Range
Dim Cell As Range
Dim tempSheet As Worksheet
Dim counter As Long

Set myRange = Activesheet.Range("A1:E5")
Set tempSheet = Sheets.Add

counter = 0
For Each Cell In myRange
counter = counter + 1
tempSheet.Cells(counter, 1).Value = Cell.Value
Next Cell

tempSheet.Range(Cells(1, 1), Cells(counter, 1)). _
Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess

counter = 0
For Each Cell In myRange
counter = counter + 1
Cell.Value = tempSheet.Cells(counter, 1).Value
Next Cell

tempSheet.Delete

Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

Regards
Rowan

"Patrick Simonds" wrote:

I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the rows
(see example below). Can this be done?


1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25




  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

You've got more suggestions at your other posts in .excel.

Patrick Simonds wrote:

I have a worksheet with 5 columns and 5 rows. A number gets entered into
each cell (A1:E5). I need to sort so that each number is placed in
sequential order (smallest to largest) across the columns and down the rows
(see example below). Can this be done?

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25


--

Dave Peterson
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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Generating excel combinations mark4006 Excel Discussion (Misc queries) 2 March 6th 05 04:40 PM
SORTING question Rebecca New Users to Excel 3 February 24th 05 05:35 PM
Adding a KeyID column for sorting Rebecca New Users to Excel 3 February 20th 05 07:09 PM
sorting question Brian Excel Discussion (Misc queries) 4 November 28th 04 12:30 PM


All times are GMT +1. The time now is 11:57 AM.

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"