Hello,
I'd like to randomize my lines in my text.
For example my text is like this;

America
England
Greece
Malta
Nigeria
Yugoslavia

I'd like it to be mixed/shuffled/randomized like this;

Malta
Yugoslavia
England
Nigeria
America
Greece

Sort option only sorts in ascending or descending.Is there any way to
do it in word ? or is there any tool which can do it?
Thank you

Re: Randomize the lines by Jay

Jay
Mon Jun 14 16:22:12 CDT 2004

Wous Mant wrote:
> Hello,
> I'd like to randomize my lines in my text.
> For example my text is like this;
>
> America
> England
> Greece
> Malta
> Nigeria
> Yugoslavia
>
> I'd like it to be mixed/shuffled/randomized like this;
>
> Malta
> Yugoslavia
> England
> Nigeria
> America
> Greece
>
> Sort option only sorts in ascending or descending.Is there any way to
> do it in word ? or is there any tool which can do it?
> Thank you

Use a macro like this one. It converts the selected text (or the whole
document, if nothing is selected) to a table, adds a column, populates the
new column with random numbers, sorts the table so the numbers are in order
(which scrambles the paragraphs), and converts the table back to text.

Sub Scramble()
Dim oTbl As Table
Dim nRow As Integer, maxRow As Integer

Application.ScreenUpdating = False

If (Selection.Type <> wdSelectionNormal) _
Or (Selection.Paragraphs.Count < 2) Then
ActiveDocument.Range.Select
End If

Set oTbl = Selection.ConvertToTable(Separator:=vbCr)
With oTbl
maxRow = .Rows.Count
.Columns.Add beforecolumn:=.Columns(1)

For nRow = 1 To maxRow
.Cell(nRow, 1).Range.Text = _
CInt(Rnd() * 10 * maxRow)
Next nRow

.Sort excludeheader:=False, _
fieldnumber:=1, _
sortfieldtype:=wdSortFieldNumeric, _
sortorder:=wdSortOrderAscending

.Columns(1).Delete
.ConvertToText Separator:=vbCr
End With

Application.ScreenUpdating = True
End Sub

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



Re: Randomize the lines by wous505

wous505
Mon Jun 14 23:41:00 CDT 2004

I can not manage it to work :-<
Is the macro only way?

Re: Randomize the lines by Jay

Jay
Tue Jun 15 14:56:42 CDT 2004

Wous Mant wrote:
> I can not manage it to work :-<
> Is the macro only way?

Except for manually dragging the items from one place to another so they
look random, a macro is the only way Word can do it.

Have a look at this page, you may get it to work --
http://www.gmayor.com/installing_macro.htm

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



Re: Randomize the lines by wous505

wous505
Wed Jun 16 17:04:27 CDT 2004

Thank you Jay Freedman
Macro worked perfectly. It randomizes now how I want.
Regards