How do I mix up an ordered list into a random list?

C

CyberTaz

I don't know of any standard feature to randomize or "unsort" a list. There
may be a way to do so with a macro, but Drag 'n' Drop should get the job
done.
 
D

Doug Robbins - Word MVP

Here is some code that I prepared for a teacher who wanted to create
separate documents with questions in a different random order for each of
his students (so that he could tell who had been doing their own work and
who had just copied someone else's)

Dim i As Integer, j As Integer, k As Integer, Source As Document, Target As
Document, students As Integer

Dim Message, Title, question As Range

Message = "Enter number of students" ' Set prompt.

Title = "Randomizer" ' Set title.

' Display message, title

students = InputBox(Message, Title)



For k = 1 To students

Set Source = Documents.Open("E:\Worddocs\source1.doc")

Set Target = Documents.Add

For i = 100 To 0 Step -1

j = Int((i * Rnd) + 1)

Set question = Source.Paragraphs(j).Range

Target.Range.InsertAfter question

question.Delete

Next i

' Print and Close Document with random list of questions

Target.PrintOut

' Target.SaveAs ("E:\worddocs\student" & k & ".doc")

Target.Close SaveChanges:=wdDoNotSaveChanges

Source.Close SaveChanges:=wdDoNotSaveChanges

Next k


--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top