OK, then. Here is ONE way.
Copy this lot and dump it into a new module in Excel VBA. Check the note at the bottom, and change those 4 signs. (This website sees them as HTML tag indicators, so I couldn't include them)Then run it.
Now: promise me you're going to LEARN how to do this, right? RIGHT?
Write back if you need me to explain why I've done things certain ways.
[And before anyone else criticises the structure, I've through-written in one module (and one function) because I think its easier for a noobie to learn like that.]
Cheerio, Tom
Sub MultiChoice()
Dim quest$(10), ans$(10, 4), cAns(10), whatQuestion$
Dim qOrder(10), qToAsk, reTry As Boolean
Dim score
'Create a random order for 10 questions and load into array qOrder()
score = 0
counter = 1
For g = 1 To 10
Do
reTry = False
qToAsk = Int(Rnd * 10) + 1
For t = 1 To g
If qOrder(t) = qToAsk Then reTry = True: Exit For
Next t
Loop While reTry = True
qOrder(g) = qToAsk
Next g
'These are the questions, and answers
quest$(1) = "How many legs has a horse?"
ans$(1, 1) = "Three"
ans$(1, 2) = "None"
ans$(1, 3) = "Twenty, and a bit"
ans$(1, 4) = "Four"
cAns(1) = 4
quest$(2) = "Why is a mouse when it spins?"
ans$(2, 1) = "Eh?"
ans$(2, 2) = "The higher the fewer"
ans$(2, 3) = "Don't give me that"
ans$(2, 4) = "Who's askin'?"
cAns(2) = 2
quest$(3) = "What does RAM stand for?"
ans$(3, 1) = "Random Access Memory"
ans$(3, 2) = "Really Artificial Meringue"
ans$(3, 3) = "Random Answer Machine"
ans$(3, 4) = "Rootling Around Mineshafts"
cAns(3) = 1
quest$(4) = "Where might one find the word Bisbigliando?"
ans$(4, 1) = "Where one left it"
ans$(4, 2) = "On a map"
ans$(4, 3) = "On sheet music"
ans$(4, 4) = "Indoors, keeping out of the rain"
cAns(4) = 3
quest$(5) = "Who controls the computing.net boards?"
ans$(5, 1) = "Justin"
ans$(5, 2) = "What's computing.net?"
ans$(5, 3) = "No-one"
ans$(5, 4) = "They're controlled?"
cAns(5) = 1
quest$(6) = "What was Arsenal's winning Champions League scoreline on Wednesday?"
ans$(6, 1) = "1-0"
ans$(6, 2) = "2-1"
ans$(6, 3) = "3-2"
ans$(6, 4) = "4-1"
cAns(6) = 4
quest$(7) = "What's the difference between a duck?"
ans$(7, 1) = "One of its legs is both the same."
ans$(7, 2) = "You'd better ask the England cricket team"
ans$(7, 3) = "Would you pass the plum sauce, please?"
ans$(7, 4) = "Quack"
cAns(7) = 1
quest$(8) = "Which of these is a number?"
ans$(8, 1) = "Multiplex"
ans$(8, 2) = "Duplex"
ans$(8, 3) = "Googol-plex"
ans$(8, 4) = "simplex"
cAns(8) = 3
quest$(9) = "What word must NEVER be used in its correct form" & Chr(13) _
& "by anybody posting on a public internet forum"
ans$(9, 1) = "Their"
ans$(9, 2) = "There"
ans$(9, 3) = "They're"
ans$(9, 4) = "All of the above"
cAns(9) = 4
quest$(10) = "What's the best way to do a multi-choice test in VB?"
ans$(10, 1) = "Your own way"
ans$(10, 2) = "By getting someone else to do it for you"
ans$(10, 3) = "Its not possible"
ans$(10, 4) = "None of the above"
cAns(10) = 2
'Now lets have the quiz
For q = 1 To 10
'create the question
whatQuestion$ = quest$(qOrder(q)) & Chr(13) & Chr(13) _
& "1: " & ans$(qOrder(q), 1) & Chr(13) _
& "2: " & ans$(qOrder(q), 2) & Chr(13) _
& "3: " & ans$(qOrder(q), 3) & Chr(13) _
& "4: " & ans$(qOrder(q), 4) & Chr(13) & Chr(13) _
& "Please enter a number from 1 to 4"
reTry = True
Do While reTry = True
a = InputBox(whatQuestion$, "Quiz!")
reTry = quickCheck(a)
Loop
If a = cAns(qOrder(q)) Then score = score + 1
Next q
Dim scoreChk$(10)
scoreChk$(0) = "You are brain dead"
scoreChk$(1) = "You must be a sort of fungus"
scoreChk$(2) = "Absolutely pathetic"
scoreChk$(3) = "Skipped those lessons, eh?"
scoreChk$(4) = "A significant improvement on George bush's score"
scoreChk$(5) = "Your glass is still half empty"
scoreChk$(6) = "Not as bad as your looks might have suggested"
scoreChk$(7) = "You know your onions!"
scoreChk$(8) = "You're far too bright for a quiz like this!"
scoreChk$(9) = "Do the lights dim when you walk into a room?"
scoreChk$(10) = "Perfect.."
finalWord = MsgBox("Your score was " & score & " out of 10", vbOKOnly, scoreChk$(score))
End Sub
Function quickCheck(numToCheck) As Boolean
If IsNumeric(numToCheck) = False Then quickCheck = True: Exit Function
numToCheck = Val(numToCheck)
If numToCheck = 1 or numToCheck =2 or numToCheck = 3 or numToCheck = 4 Then quickCheck = False else quickCheck = True
End Function
'(and before anyone gets at me for that last line, greater than and less than symbols act as HTML tag indicators on this board so I couldn't post them...)