Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
K K is offline
external usenet poster
 
Posts: 108
Default Sort a list across collumns

Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Sort a list across collumns

Hi
Can't you copy all into one column, sort it, then copy it back in
pieces into the five columns.
regards

Paul
On Mar 21, 2:39 pm, K wrote:
Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Sort a list across collumns

How many names are in each column and how are they seperated? Are there just
blanks between the names? what should the results look like?

"K" wrote:

Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Sort a list across collumns

Sub SortRows()
'Tom Ogilvy macro
Dim r As Long
Dim Lrow As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Lrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

'Make the r = 1 whatever the first row of data you want to sort on is.
'The Cells(r, 1) means your data starts in Col 1 or Col A - adjust as
'necessary
'The resize(1, 5) expands the range to 1 cell deep by 5 cells wide

For r = 1 To Lrow
With Cells(r, 1).Resize(1, 5)
.Sort Key1:=Cells(r, 1), Order1:=xlAscending, Header:=xlGuess, _
Orientation:=xlLeftToRight, DataOption1:=xlSortNormal
End With
Next r

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub


Gord Dibben MS Excel MVP

On Wed, 21 Mar 2007 07:39:08 -0700, K wrote:

Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry


  #5   Report Post  
Posted to microsoft.public.excel.programming
K K is offline
external usenet poster
 
Posts: 108
Default Sort a list across collumns

great

thanks

k

"Gord Dibben" wrote:

Sub SortRows()
'Tom Ogilvy macro
Dim r As Long
Dim Lrow As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Lrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

'Make the r = 1 whatever the first row of data you want to sort on is.
'The Cells(r, 1) means your data starts in Col 1 or Col A - adjust as
'necessary
'The resize(1, 5) expands the range to 1 cell deep by 5 cells wide

For r = 1 To Lrow
With Cells(r, 1).Resize(1, 5)
.Sort Key1:=Cells(r, 1), Order1:=xlAscending, Header:=xlGuess, _
Orientation:=xlLeftToRight, DataOption1:=xlSortNormal
End With
Next r

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub


Gord Dibben MS Excel MVP

On Wed, 21 Mar 2007 07:39:08 -0700, K wrote:

Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Sort a list across collumns

And thanks to Tom.

Gord

On Wed, 21 Mar 2007 13:40:46 -0700, K wrote:

great

thanks

k

"Gord Dibben" wrote:

Sub SortRows()
'Tom Ogilvy macro
Dim r As Long
Dim Lrow As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Lrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

'Make the r = 1 whatever the first row of data you want to sort on is.
'The Cells(r, 1) means your data starts in Col 1 or Col A - adjust as
'necessary
'The resize(1, 5) expands the range to 1 cell deep by 5 cells wide

For r = 1 To Lrow
With Cells(r, 1).Resize(1, 5)
.Sort Key1:=Cells(r, 1), Order1:=xlAscending, Header:=xlGuess, _
Orientation:=xlLeftToRight, DataOption1:=xlSortNormal
End With
Next r

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub


Gord Dibben MS Excel MVP

On Wed, 21 Mar 2007 07:39:08 -0700, K wrote:

Hi there,

I have about 5 equal columns of names that I need to sort alphabetically
accross the columns.

I don't want to put it into one column because I want to use the width of
the screen.

Is it possible to do a macro to sort this. I can't seem to do it from the
menus.

Has anyone any suggestions.

Thanks in advance for any help

Kerry




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
SUM IF sum of two collumns petran Excel Discussion (Misc queries) 2 November 18th 08 11:48 AM
I want sort a list but the sort is unlit on the home tab how do I chetrx Excel Worksheet Functions 3 November 14th 08 11:47 PM
How do I sort collumns and leave out pictures in rows not used? TobyS. Excel Worksheet Functions 0 March 11th 08 10:16 PM
Collumns Static Excel Discussion (Misc queries) 1 October 30th 07 07:32 AM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM


All times are GMT +1. The time now is 04:07 AM.

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

About Us

"It's about Microsoft Excel"