Sub NumberGuess()
Dim ranNumber As Integer
Dim userGuess As Integer
Randomize
ranNumber = Int(Rnd * 10) + 1
userGuess = InputBox("Guess a number between 1 and 10", "Number Guess")
If ranNumber = userGuess Then
Debug.Print ("You got it!")
Else
Debug.Print ("No, the correct answers was " & ranNumber)
End If
End Sub
Sub NumberGuess1()
Dim ranNumber As Integer
Dim userGuess As Integer
Randomize
ranNumber = Int(Rnd * 10) + 1
userGuess = InputBox("Guess a number between 1 and 10", "Number Guess")
If ranNumber = userGuess Then
Debug.Print ("You got it!")
Else
If ranNumber < userGuess Then
userGuess = InputBox("Too high, guess again ", "Number Guess")
If ranNumber = userGuess Then
Debug.Print ("You got it!")
Else
Debug.Print ("No, the correct answer was " & ranNumber)
End If
Else
userGuess = InputBox("Too low, guess again ", "Number Guess")
If ranNumber = userGuess Then
Debug.Print ("You got it!")
Else
Debug.Print ("No, the correct answer was " & ranNumber)
End If
End If
End If
End Sub
|