Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I sort this table?

0 views
Skip to first unread message

Martin 忽帕

unread,
Oct 15, 2002, 12:08:06 PM10/15/02
to
How do I sort this table into number order keeping the artist's name
above and together with their paintings, medium and price.
This is only a sample of the list which takes about 6 pages A4
The list always starts at number 1 but the total number of paintings
will vary from exhibition to exhibition.
Using Word 2000
Any help to get this sorted greatly appreciated
Martin
©¿©¬
removethis to email
========================================================
NO. MEDIUM PRICE
Fleck Margaret
106 NASTURTIUM Watercolour £90
105 TULIPS Watercolour £95
104 RED BAY - WATERFOOT Pastel £100
107 BLUEBELLS Watercolour £58

Fleck William
109 DONEGAL Watercolour £75
108 FARM HOUSE - GLENS OF ANTRIM Watercolour £75
110 A "GREY DAY" Watercolour £55

Gawn May
57 AN APPLE A DAY Watercolour £80
54 COTTAGE GARDEN Watercolour £70
55 SUNSHINE AND SHADOW (1) Watercolour £48
56 SUNSHINE AND SHADOW (2) Watercolour £48

Gingles Thora
85 ANYBODY HOME? OIL £60
84 POPPIES Watercolour £50
83 ROSE OIL £45

Bones Caroline
87 AT SEA Watercolour £50
88 COTTAGE IN ACHILL ISLAND Watercolour £55
86 DONEGALL COTTAGE Watercolour £40
91 CALM WATERS Watercolour £55
90 GALWAY COAST Watercolour £55
89 A SEASIDE COTTAGE Watercolour £55

Richard O. Neville

unread,
Oct 15, 2002, 2:37:56 PM10/15/02
to
I can't tell from the information supplied how best to do it. I would
suggest trying to create the list in Excel rather than Word, because Excel
has much more powerful sorting tools, and you can also format cells for £
currency. Copy everything to an Excel document and see if that works better;
you can go back to Word if it doesn't.

"Martin ©¿©¬" <mar...@martinmcd.fsnet.co.uk> wrote in message
news:87foqu46o9gsfd283...@4ax.com...

Jay Freedman

unread,
Oct 15, 2002, 9:57:50 PM10/15/02
to
Hi, Martin,

If you were to do this manually, you could highlight a single group of numbered
lines and click Table | Sort, OK. (Text doesn't have to be in a table to be
sorted this way, simple paragraphs will do.) Then you'd select the next group,
sort that one, and so on.

This is tedious enough that it's worth writing a macro. See
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm for instructions on how
to get a macro into your template. One caution: if your list is in an actual
table with multiple cells per row, this macro won't work right because it
assumes each line is a paragraph.

Sub SortNumberedLines()
Dim SortRange As Range
Dim TestRange As Range
Dim Done As Boolean
Dim SubrangeDone As Boolean
Dim NumSet As String

' set of digits, used by .MoveEndWhile
NumSet = "0123456789"

Set TestRange = ActiveDocument.Range
Done = False

Do While Not Done
' Find the next line that starts
' with a number
With TestRange.Find
.ClearFormatting
.Text = "^13[0-9]{1,}"
.Format = False
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
Done = Not .Execute
End With

If Not Done Then
SubrangeDone = False

' After the find, the first paragraph
' in TestRange is just the ^p, and the
' number is in the second paragraph
Set SortRange = _
TestRange.Paragraphs(2).Range

Do While Not SubrangeDone
' Start TestRange at the end of the
' current SortRange
Set TestRange = SortRange.Duplicate
TestRange.Collapse wdCollapseEnd

' Move the right end to include all
' contiguous digits
TestRange.MoveEndWhile Cset:=NumSet

' Did we get any digits?
If Len(TestRange.Text) > 0 Then
' Yes, so add this paragraph to
' SortRange
SortRange.MoveEnd wdParagraph, 1
Else
' No, we've gotten all the
' numbered paragraphs in this group
SubrangeDone = True
End If
Loop

' Sort the contiguous numbered paragraphs
SortRange.Sort
End If
Loop
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word

Martin 忽帕

unread,
Oct 16, 2002, 10:04:44 AM10/16/02
to
On Tue, 15 Oct 2002 14:37:56 -0400, "Richard O. Neville"
<rone...@sprintmail.com> wrote:

>I can't tell from the information supplied how best to do it. I would
>suggest trying to create the list in Excel rather than Word, because Excel

>has much more powerful sorting tools, and you can also format cells for Ł


>currency. Copy everything to an Excel document and see if that works better;
>you can go back to Word if it doesn't.

Thanks Richard
I'm trying to do this in Xl too, just though as the original doc was
in Word there might be a better\easier\quicker way to do it in Word

Martin
ŠżŠŹ
removethis to email

Martin 忽帕

unread,
Oct 16, 2002, 10:04:45 AM10/16/02
to
On Tue, 15 Oct 2002 21:57:50 -0400, "Jay Freedman"
<jay.fr...@verizon.net> wrote:

>Hi, Martin,
>
>If you were to do this manually, you could highlight a single group of numbered
>lines and click Table | Sort, OK. (Text doesn't have to be in a table to be
>sorted this way, simple paragraphs will do.) Then you'd select the next group,
>sort that one, and so on.

Thanks Jay
However, what I need is to sort the numbers (eg 1 - 150) and keep the
artist's name associated with his\her paintings - with a blank
row\space between each artist and their paintings and the next artist
and his\her paintings.

Not sure if your macro would work with this
It's a table with multiple cells per row. But I'm keeping a copy

Martin
忽帕
removethis to email

Klaus Linke

unread,
Oct 21, 2002, 9:16:55 PM10/21/02
to
Hi Martin,

You say it's a table with multiple cells per row?
Then, from your example, I assume that the columns are for number, title,
type and price, and the artist's name always is in a row with merged cells
as a kind of heading?

As far as I can see, you'd have to get the artist's name into its own
column, once for each of their works.

One trick that may help you with that: Let's say you created an empty
column as the second column. Then you can copy the artist's name to the
clipboard, select all empty cells belonging to that artist's works in the
second column, and paste. The name will appear in each cell.

When you are done, you can sort the table.
You can get rid of the title rows with the artist's names with a trick:
Sort as "Text" first, then the artist's names will all sort to the end of
the table (below the numbers), where you can easily delete them.

Then, you can sort as "Numbers" (in case the numbers don't always have the
same number of digits).

Hope I "interpreted" your table structure correctly (or that you can adapt
the method),
Klaus


"Martin 忽帕" <mar...@martinmcd.fsnet.co.uk> schrieb im Newsbeitrag
news:egpqqugbsb08fertd...@4ax.com...

0 new messages