There are several ways to implement this code structure. The most basic uses just one line of code.
Private Sub GuessAge()
Dim userGuess As Integer
Dim age As Integer
age = 25
userGuess = Val(InputBox(“Guess a number between 20 and 30.”, “Guess Age”))
If (userGuess > age) Then
MsgBox (“Too high!”)
MsgBox (“The answer is “ & age)
End If
If (userGuess < age) Then
MsgBox (“Too low!”)
MsgBox (“The answer is “ & age)
End If
If (userGuess = age) Then MsgBox (“You got it!”)
End Sub
1 comment:
thank you for nice information, finally found what I'm looking for!!!
visit our website : muhammad solehuddin
Post a Comment