Task

Write a game (computer program) that follows the following rules:

 The computer chooses a number between given set limits.
 The player is asked for repeated guesses until the the target number is guessed correctly
 At each guess, the computer responds with whether the guess is:
 higher than the target,
 equal to the target, 
 less than the target,   or
 the input was inappropriate. 


Related task

   Guess the number/With Feedback (Player)


Sub GuessTheNumberWithFeedback()
Dim Nbc&, Nbp&, m&, n&, c&
 
    Randomize Timer
    m = 11
    n = 100
    Nbc = Int((Rnd * (n - m + 1)) + m)
    Do
        c = c + 1
        Nbp = Application.InputBox("Choose a number between " & m & " and " & n & " : ", "Enter your guess", Type:=1)
        Select Case Nbp
            Case Is > Nbc: MsgBox "Higher than target!"
            Case Is < Nbc: MsgBox "Less than target!"
            Case Else: Exit Do
        End Select
    Loop
    MsgBox "Well guessed!" & vbCrLf & "You find : " & Nbc & " in " & c & " guesses!"
End Sub