random

  • Thread starter Thread starter nyn04
  • Start date Start date
N

nyn04

yes Iwill like it to be interactive with input and msgbox, th
questions I can put in the code itself they are basic its fo
memorization puposes, I will like it to be random so it does not as
the questions in the same order everytime, so memorization is mor
effective.

???
 
SOmething along these lines would work

Simpe but effective


A B C
1 What is the Capital of France paris
2 What is Two and Two 4
3 What is the square root of 9 3
4 What is PI to 6 decimal places 3.14287
5 Do Fish swim yes
6 Do Birds fly no
7 Who is the PrimeMinister of England n10
8 Who wrote Shakespears Sonnets shakespear
9 Who composed Faures requime Mass faure
10 Are you always right no




Sub Questions()

' HIDEs Q/A

Rows("1:10").Select
Selection.EntireRow.Hidden = True


MsgBox ("Enter stop in the input box to end the test") & vbCr & (" You may
have 50 attempts * USE LOWER CASE ONLY * or numbers where appropriate ")


Dim x, y, attempts, ca As Integer
Dim question As String
Dim reply As String
Dim answer As String

For x = 1 To 50
Range("a1").Select

q = Int(Rnd() * 10)

Range("A1").Select
Do Until ActiveCell.Value = q
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 1).Select
question = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
reply = ActiveCell.Value

answer = InputBox(question)
If answer = "stop" Then Rows("1:10").Select
If answer = "stop" Then Selection.EntireRow.Hidden = False

If answer = "stop" Then Exit For
If answer = reply Then ca = ca + 1
attempts = attempts + 1
If answer = reply Then MsgBox ("ROCKING YOU GOT IT RIGHT")
If answer <> reply Then MsgBox ("The response was incorrect ")
MsgBox ("YOU HAVE ANSWERED ") & attempts & (" QUESTIONS WITH ") & ca & ("
CORRECT ANSWERS SO FAR ") & vbCr & " " & vbCr & (" THE CORRECT ANSWER WAS
") & reply

Next


Rows("1:10").Select
Selection.EntireRow.Hidden = False


MsgBox (" YOU HAVE HAD ") & attempts & (" QUESTIONS WITH ") & ca & ("
CORRECT ANSWERS SO FAR")


End Sub
 

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

Back
Top