![]() |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com