Sorting 100 rows of 6 records horizontally

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to sort the 6 records in each separate row (100 total) ascending.
Is there a built-in function to do that.

I tried to use the macro recorder to sort the rows manually but 100 is too tedious, I would appreciate any hints for a killer macro..

TIA
 
perhaps you could transpose the 6cols x 100 rows to 100 cols x 6 rows, use
the columns.sort method (or some such) to sort each column alone, then
retranspose to 6 x 100.

--
Bob Kilmer

Victor said:
I would like to sort the 6 records in each separate row (100 total) ascending.
Is there a built-in function to do that.

I tried to use the macro recorder to sort the rows manually but 100 is too
tedious, I would appreciate any hints for a killer macro..
 
I had already tried that but it only sorts the first 3
columns at the max
 
Go programmatically thru the columns, sorting each column itself, not the
entire range of columns.
 
Option Explicit

Sub SortColumns()
Dim rng As Range
Dim col As Range

Set rng = Workbooks("Book2.xls").Worksheets("Sheet1").Columns
For Each col In rng
rng.Sort col
Next
End Sub

Change rng to whatever range you like. Perhaps, for your case,

Set rng = Workbooks("Book2.xls").Worksheets("Sheet1").Columns("A:CV")
'100 columns

There are also clever ways to select the range dynamically, or you can use
the active selection (called Selection).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top