ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sorting multiple rows... (https://www.excelbanter.com/excel-discussion-misc-queries/247514-sorting-multiple-rows.html)

Treadstone

Sorting multiple rows...
 
How can i sort multiple rows from left to right where typically there are
about 50 columns but only maybe 5 or 6 cells in each row have the data that i
want to line up beside each other i have done it before but had to do it
manually a row at a time and there are over 900 rows.?

JBeaucaire[_131_]

Sorting multiple rows...
 
Can you provide a sample before/after of what you're trying to do?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

How can i sort multiple rows from left to right where typically there are
about 50 columns but only maybe 5 or 6 cells in each row have the data that i
want to line up beside each other i have done it before but had to do it
manually a row at a time and there are over 900 rows.?


Treadstone

Sorting multiple rows...
 
I have several columns to the right of a column with names many empty and
some with dates trying to sort all of these dates in order from left to right
all next to each other so i can have a smaller spreadsheet for easy reference
-- with no gaps (eg column A has the name column B has the first date column
C the second date and so on.
Thus rendering the cells with no data to the right of the final date and
making the spreadsheet to about 6 or 7 columns instead of the usual 50 where
the original information is taken from

"JBeaucaire" wrote:

Can you provide a sample before/after of what you're trying to do?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

How can i sort multiple rows from left to right where typically there are
about 50 columns but only maybe 5 or 6 cells in each row have the data that i
want to line up beside each other i have done it before but had to do it
manually a row at a time and there are over 900 rows.?


JBeaucaire[_131_]

Sorting multiple rows...
 
Try this:

========
Option Explicit

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 11/4/2009 by
'

'
ActiveSheet.Previous.Select
Columns("N:N").Select
Selection.Find(What:="ddd3", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub
Sub DateSorting()
'JBeaucaire (11/4/2009)
Dim LC As Long, LR As Long, i As Long, MyArr
Application.ScreenUpdating = False
LR = Range("A" & Rows.Count).End(xlUp).Row
LC = Range("A1").SpecialCells(xlCellTypeLastCell).Colum n


For i = 1 To LR
Range("B" & i, Cells(i, LC)).Copy
Cells(1, LC + 2).PasteSpecial xlPasteAll, skipblanks:=True,
Transpose:=True
Range("B" & i, Cells(i, LC)).ClearContents
Columns(LC + 2).Sort Key1:=Cells(1, LC + 2), Order1:=xlAscending,
Header:=xlNo
LR = Cells(Rows.Count, LC + 2).End(xlUp).Row
Range(Cells(1, LC + 2), Cells(LR, LC + 2)).Copy
Range("B" & i).PasteSpecial xlPasteAll, Transpose:=True
Columns(LC + 2).ClearContents
Next i

Application.ScreenUpdating = True
End Sub
==========

Does that work for you?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

I have several columns to the right of a column with names many empty and
some with dates trying to sort all of these dates in order from left to right
all next to each other so i can have a smaller spreadsheet for easy reference
-- with no gaps (eg column A has the name column B has the first date column
C the second date and so on.
Thus rendering the cells with no data to the right of the final date and
making the spreadsheet to about 6 or 7 columns instead of the usual 50 where
the original information is taken from

"JBeaucaire" wrote:

Can you provide a sample before/after of what you're trying to do?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

How can i sort multiple rows from left to right where typically there are
about 50 columns but only maybe 5 or 6 cells in each row have the data that i
want to line up beside each other i have done it before but had to do it
manually a row at a time and there are over 900 rows.?


JBeaucaire[_131_]

Sorting multiple rows...
 
Sorry, copied in too much:

======
Option Explicit

Sub DateSorting()
'JBeaucaire (11/4/2009)
Dim LC As Long, LR As Long, i As Long, MyArr
Application.ScreenUpdating = False
LR = Range("A" & Rows.Count).End(xlUp).Row
LC = Range("A1").SpecialCells(xlCellTypeLastCell).Colum n


For i = 1 To LR
Range("B" & i, Cells(i, LC)).Copy
Cells(1, LC + 2).PasteSpecial xlPasteAll, skipblanks:=True,
Transpose:=True
Range("B" & i, Cells(i, LC)).ClearContents
Columns(LC + 2).Sort Key1:=Cells(1, LC + 2), Order1:=xlAscending,
Header:=xlNo
LR = Cells(Rows.Count, LC + 2).End(xlUp).Row
Range(Cells(1, LC + 2), Cells(LR, LC + 2)).Copy
Range("B" & i).PasteSpecial xlPasteAll, Transpose:=True
Columns(LC + 2).ClearContents
Next i

Application.ScreenUpdating = True
End Sub
==========

--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

I have several columns to the right of a column with names many empty and
some with dates trying to sort all of these dates in order from left to right
all next to each other so i can have a smaller spreadsheet for easy reference
-- with no gaps (eg column A has the name column B has the first date column
C the second date and so on.
Thus rendering the cells with no data to the right of the final date and
making the spreadsheet to about 6 or 7 columns instead of the usual 50 where
the original information is taken from

"JBeaucaire" wrote:

Can you provide a sample before/after of what you're trying to do?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)

Your feedback is appreciated, click YES if this post helped you.


"Treadstone" wrote:

How can i sort multiple rows from left to right where typically there are
about 50 columns but only maybe 5 or 6 cells in each row have the data that i
want to line up beside each other i have done it before but had to do it
manually a row at a time and there are over 900 rows.?



All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com