View Single Post
  #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