Is it possible to randomize data in a list

D

Doug Robbins - Word MVP

Take a look at the following that was created for someone who wanted to
produce sets of test questions in a different random order for each student:

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
 
G

Guest

Thank you, I don't know if I understand your reply, but if I can't figure it
out, then I will ask about that. Thank you for your help
Dev
 

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

Similar Threads

Bullet lists and paras STYLES 22
Randomized data tables 4
Random Generator in Excel? 4
Randomly assigning Data 1
Fried battery ? 3
Random Selection 3
Wanted Anyone have some DDR3 for sale 0
Random number from a list 1

Top