LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 91
Default Sorting down and over

Thanks for your macro help. I'm not sure I have the skills to use but I'm
going to try. Thanks so much,

"Gord Dibben" wrote:

I will assume you have a title in A1 of City and a title in B1 of Route.

Run this macro to sort then move your data into 6 columns in a snaked
fashion.

Public Sub Snake2to6_sorted()
Dim myRange As Range
Dim colsize As Long
Dim maxrow As Long
Const numgroup As Integer = 3
Const NumCols As Integer = 6
On Error GoTo fileerror
Columns("A:B").Select
Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
colsize = Int((ActiveSheet.UsedRange.Rows.Count + _
((NumCols - 1)) / NumCols)) / numgroup
Range("A2").Select
With ActiveCell.Parent.UsedRange
maxrow = .Cells(.Cells.Count).Row + 1
End With
ActiveCell.Parent.Cells(maxrow, ActiveCell.Column) _
.End(xlUp).Offset(1, 0).Select
Set myRange = Range(ActiveCell.Address & ":" _
& ActiveCell.Offset(-colsize, (numgroup - 2)).Address)
myRange.Cut Destination:=ActiveSheet.Range("A2").Offset(0, _
((NumCols) - (numgroup - 1)))
Range("A2").Select
Cells.End(xlDown).Offset(1, 0).Select
Set NextRange = Range(ActiveCell.Address & ":" _
& ActiveCell.Offset(-colsize, (numgroup - 2)).Address)
NextRange.Cut Destination:=ActiveSheet.Range("A2").Offset(0, _
(NumCols / numgroup))
Application.CutCopyMode = False
Range("C1:D1").Value = Range("A1:B1").Value
Range("E1:F1").Value = Range("A1:B1").Value
Range("A1").Select
fileerror:
End Sub


Gord Dibben MS Excel MVP


On Tue, 23 Dec 2008 10:46:02 -0800, JICDB
wrote:

My data looks like this:

Addison 111-222-333-444
Aurora 541 - 542 - 543
Bensenville 444-555-666
20 pages worth of this data

What I want (but don't think I can do with Excel):

Addison 111-222-333-444 Calumet City 222-111
Aurora 541 - 542 - 543 Crystal Lake 222
Bensenville 444-555-666 Danville 444
continues in alpha order but wraps to top continued in alpha order
of page on right - will be 10 pages or so.


"xlm" wrote:

I don't get how your data is being layout now.
Would you show an example how your current layout is like and
what is the result you like to have.


--
If this posting was helpful, please click on the Yes button

Thank You

cheers,









"JICDB" wrote:

I'm hoping someone can save me alot of work and aggrevation. I have a list
of cities in alphabetical order in column A and in column B a list of the bus
route numbers that serve those cities. This list is 20 pages long. If I
show it the way it is there is plenty of white space with lots of trees being
killed in the process. I want the data to show in two general columns but It
must remain in alphabetical order by city. Sort of like Word when you put
the data in columns. I want to use Excel because the remainder of the
booklet is in Excel.

Other than cutting and pasting the data at the page breaks and moving the
data around manually is there some way to do this?






 
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
Automatic sorting (giving max and min) based on custom sorting lis Joe Lewis[_2_] Excel Worksheet Functions 4 November 23rd 08 05:12 AM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Sorting Arun Kumar Saha Excel Worksheet Functions 1 July 4th 07 06:45 PM
Sorting appeng Excel Discussion (Misc queries) 4 April 29th 07 07:41 PM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM


All times are GMT +1. The time now is 03:55 PM.

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"