I am doing a button where when you press it, it presents two numbers between 1 and 15 and wants the user to input the answer. If the user is wrong, it tells them incorrect try again if they get it right it tells them correct. I have this code written up but an error keeps popping up. I do not know where i went wrong.
Dim num1 As Integer
Dim num2 As Integer
Dim guess As Integer
Dim product As Integer
num1 = Application.RandBetween(1, 15)
num2 = Application.RandBetween(1, 15)
product = num1 * num2
guess = InputBox("num1 * num2 =")
Do While guess <> product
If guess > product Then
InputBox ("sorry, that is incorrect. try again: [num1] * [num2]")
ElseIf guess < product Then
InputBox ("sorry, that is incorrect. try again: [num1] * [num2]")
ElseIf guess = product Then
MsgBox "Correct. num1 * num2 = product"
Dim num1 As Integer
Dim num2 As Integer
Dim guess As Integer
Dim product As Integer
num1 = Application.RandBetween(1, 15)
num2 = Application.RandBetween(1, 15)
product = num1 * num2
guess = InputBox("num1 * num2 =")
Do While guess <> product
If guess > product Then
InputBox ("sorry, that is incorrect. try again: [num1] * [num2]")
ElseIf guess < product Then
InputBox ("sorry, that is incorrect. try again: [num1] * [num2]")
ElseIf guess = product Then
MsgBox "Correct. num1 * num2 = product"
VBA Code: