Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Dugie Dugie is offline
external usenet poster
 
Posts: 3
Default Sort from top to bottom in a multi-column table

Hi,

Is it possible to alphabetically sort text in a Word table, from top to bottom, and continue the sort to the adjacent columns? I don't want a right to left (across rows) sort.

Like this:
apple limes
bacon melons
butter oranges
herring steak

Not this:
apple bacon
butter herring
limes melons
oranges steak

Thank you!

Dugie
  #2   Report Post  
Posted to microsoft.public.word.tables
Luc Luc is offline
external usenet poster
 
Posts: 271
Default Sort from top to bottom in a multi-column table

Dugie,
You could put your list in text columns which flow frow top to bottom. Then
sort the paragraphs accordingly. You can sort paragraphs via Table - sort -
sort by paragraph.

--
Luc Sanders
(MVP - PowerPoint)
"Dugie" schreef in bericht
...
Hi,

Is it possible to alphabetically sort text in a Word table, from top to
bottom, and continue the sort to the adjacent columns? I don't want a right
to left (across rows) sort.

Like this:
apple limes
bacon melons
butter oranges
herring steak

Not this:
apple bacon
butter herring
limes melons
oranges steak

Thank you!

Dugie


  #3   Report Post  
Posted to microsoft.public.word.tables
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Sort from top to bottom in a multi-column table

Try running this macro on the table:

Sub DownThenAccrossTableSorter()
Dim i As Long
Dim j As Long
Dim k As Long
Dim oCell As Cell
Dim oTmpTable As Table
Dim oRng As Word.Range
i = Selection.Tables(1).Range.Cells.Count
'Insert a temporary 1 column/multi-row table at the end of the document
With ActiveDocument.Paragraphs.Last
.Range.Paragraphs.Add
.Range.Tables.Add .Range, i, 1
End With
'Define this table
Set oTmpTable =
ActiveDocument.Tables(ActiveDocument.Range.Tables. Count)
'Fill oTmpTable with contents of table to be sorted
For Each oCell In Selection.Tables(1).Range.Cells
With oTmpTable
.Cell(i, 1).Range.Text = Left(oCell.Range.Text,
Len(oCell.Range.Text) - 2)
End With
i = i - 1
Next
'Sort
oTmpTable.Sort
'Redefine selected table contents based on sort
With Selection.Tables(1)
For i = 1 To .Range.Columns.Count
For j = 1 To .Range.Rows.Count
k = k + 1
Set oRng = oTmpTable.Cell(k, 1).Range
.Cell(j, i).Range.Text = Left(oRng.Text, Len(oRng.Text) - 2)
Next j
Next i
End With
'Clean up.
oTmpTable.Delete
Set oRng = Nothing
Set oTmpTable = Nothing
Msgbox "Can I stop in for dinner?"
End Sub



Dugie wrote:
Hi,

Is it possible to alphabetically sort text in a Word table, from top to bottom, and continue the sort to the adjacent columns? I don't want a right to left (across rows) sort.

Like this:
apple limes
bacon melons
butter oranges
herring steak

Not this:
apple bacon
butter herring
limes melons
oranges steak

Thank you!

Dugie


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a Full Width Table in a 2 Column Document BJC Page Layout 3 May 17th 23 08:48 AM
How can I swap all the table data in column #5 so it replaces col Me Tables 1 July 25th 06 05:49 PM
Word Table: When I select a Column, some rows have 2 cells selecte DonD Microsoft Word Help 3 June 15th 06 08:40 AM
Column Breaks for Illustrations in 2 Column Table Karanja Tables 1 June 13th 06 11:45 PM
How to paste a column of text into a column in a Word Table Sam Page Layout 2 July 31st 05 08:03 PM


All times are GMT +1. The time now is 04:32 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"