A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sorting Text In Table



 
 
Thread Tools Display Modes
  #1  
Old December 28th, 2005, 07:21 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Sorting Text In Table

I have a table that has 3 columns and about 10 rows. I am trying to sort the
text in the boxes so they are in alphabetical order. My problem is that when
I push sort it will only sort by column, and not by row. For example, say the
first couple of rows look like this:
Bear Ape Cat
Ant Crow Bug

Then when I push sort it sorts the columns into alphabetical order but not
the rows, and it shows up like this:
Ant Ape Bug
Bear Crow Cat

When I would like it to look like this:
Ant Ape Bear
Bug Cat Crow

Does that make any sense? Is there a way to do that - to get it to sort by
row?

Thanks for the help!

  #2  
Old December 28th, 2005, 09:30 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Sorting Text In Table

You can't really do this in a Word table. However, there is a workaround.

Table Convert Table to text and Separate the text with Paragraph marks.
Then select the text and click Table Sort, By Paragraphs , Type: Text and
Ascending. Now Table Convert Text to table, use 3 columns and Separate
text at: Paragraph.

"Tiffany" wrote:

I have a table that has 3 columns and about 10 rows. I am trying to sort the
text in the boxes so they are in alphabetical order. My problem is that when
I push sort it will only sort by column, and not by row. For example, say the
first couple of rows look like this:
Bear Ape Cat
Ant Crow Bug

Then when I push sort it sorts the columns into alphabetical order but not
the rows, and it shows up like this:
Ant Ape Bug
Bear Crow Cat

When I would like it to look like this:
Ant Ape Bear
Bug Cat Crow

Does that make any sense? Is there a way to do that - to get it to sort by
row?

Thanks for the help!

  #3  
Old December 28th, 2005, 10:30 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Sorting Text In Table

Hi Tiffany,

without even trying to handle merged cells,
without nested tables and
without cells containing anything but text,

and assuming you know something about macros,
then, if the insertion point is in a table,
in principle:

Sub SortRows()
Dim r As Long ' rows
Dim c As Long ' columns
Dim oTbl As Table
Dim oRow As Row
Dim oArr() As String
Set oTbl = Selection.Tables(1)
For r = 1 To oTbl.Rows.Count
oArr = Split(oTbl.Rows(r).Range, chr(13) & chr(7))
WordBasic.sortarray oArr
For c = 2 To UBound(oArr)
' MsgBox c - 1 & " = [" & oArr(c) & "]"
oTbl.Rows(r).Cells(c - 1).Range.Text = oArr(c)
Next
Next
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
  #4  
Old June 9th, 2008, 04:04 PM posted to microsoft.public.word.tables
elsie
external usenet poster
 
Posts: 14
Default Sorting Text In Table


This helps a great deal. Now I know the table has to be converted to text
first and it worked. Thanks.
"SVC" wrote:

You can't really do this in a Word table. However, there is a workaround.

Table Convert Table to text and Separate the text with Paragraph marks.
Then select the text and click Table Sort, By Paragraphs , Type: Text and
Ascending. Now Table Convert Text to table, use 3 columns and Separate
text at: Paragraph.

"Tiffany" wrote:

I have a table that has 3 columns and about 10 rows. I am trying to sort the
text in the boxes so they are in alphabetical order. My problem is that when
I push sort it will only sort by column, and not by row. For example, say the
first couple of rows look like this:
Bear Ape Cat
Ant Crow Bug

Then when I push sort it sorts the columns into alphabetical order but not
the rows, and it shows up like this:
Ant Ape Bug
Bear Crow Cat

When I would like it to look like this:
Ant Ape Bear
Bug Cat Crow

Does that make any sense? Is there a way to do that - to get it to sort by
row?

Thanks for the help!

  #5  
Old June 21st, 2009, 05:48 AM posted to microsoft.public.word.tables
Akash Anu
external usenet poster
 
Posts: 1
Default Sorting Text In Table

Hi. I have a different question, please read on...

I'm able to sort text in a table. Mine is a 2-column table, and every 20 new
rows I need to select all the rows in the table and click on 'Sort'.

So can it somehow be possible that as soon as I enter a new row it goes into
its right place in the table so that the table looks sorted ? Can it be that
automatic ??

Thanks a lot.
-- Akash.

"Helmut Weber" wrote:

Hi Tiffany,

without even trying to handle merged cells,
without nested tables and
without cells containing anything but text,

and assuming you know something about macros,
then, if the insertion point is in a table,
in principle:

Sub SortRows()
Dim r As Long ' rows
Dim c As Long ' columns
Dim oTbl As Table
Dim oRow As Row
Dim oArr() As String
Set oTbl = Selection.Tables(1)
For r = 1 To oTbl.Rows.Count
oArr = Split(oTbl.Rows(r).Range, chr(13) & chr(7))
WordBasic.sortarray oArr
For c = 2 To UBound(oArr)
' MsgBox c - 1 & " = [" & oArr(c) & "]"
oTbl.Rows(r).Cells(c - 1).Range.Text = oArr(c)
Next
Next
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

  #6  
Old June 21st, 2009, 06:18 AM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Sorting Text In Table

I am afraid not.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Akash Anu" Akash wrote in message
...
Hi. I have a different question, please read on...

I'm able to sort text in a table. Mine is a 2-column table, and every 20
new
rows I need to select all the rows in the table and click on 'Sort'.

So can it somehow be possible that as soon as I enter a new row it goes
into
its right place in the table so that the table looks sorted ? Can it be
that
automatic ??

Thanks a lot.
-- Akash.

"Helmut Weber" wrote:

Hi Tiffany,

without even trying to handle merged cells,
without nested tables and
without cells containing anything but text,

and assuming you know something about macros,
then, if the insertion point is in a table,
in principle:

Sub SortRows()
Dim r As Long ' rows
Dim c As Long ' columns
Dim oTbl As Table
Dim oRow As Row
Dim oArr() As String
Set oTbl = Selection.Tables(1)
For r = 1 To oTbl.Rows.Count
oArr = Split(oTbl.Rows(r).Range, chr(13) & chr(7))
WordBasic.sortarray oArr
For c = 2 To UBound(oArr)
' MsgBox c - 1 & " = [" & oArr(c) & "]"
oTbl.Rows(r).Cells(c - 1).Range.Text = oArr(c)
Next
Next
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Looking for Help Little Penny Using Forms 6 December 27th, 2005 08:33 PM
Access combo box-show name, not ID, in table? write on New Users 30 April 30th, 2005 09:11 PM
Table Design A. Williams Database Design 3 April 29th, 2005 07:02 PM
Ideas On Producing Envelopes & Labels For Data RNUSZ@OKDPS Setting Up & Running Reports 0 April 28th, 2005 03:22 PM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM


All times are GMT +1. The time now is 11:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.