Option Explicit Sub RollTheDice() Dim Roll As Integer, Msg As String, tmp Const Title = "Roll the Dice" Do Msg = "Guess a number between 1 and 6: " While tmp < 1 Or tmp > 6 tmp = InputBox(Msg, Title) If Not IsNumeric(tmp) Then tmp = 0 Wend Roll = Dice Select Case Abs(Roll - tmp) Case 0 Msg = "Right on the money!" Case 1 Msg = "Not too bad." Case 2 Msg = "Close enough." Case 3 Msg = "Not good." Case Else Msg = "Way out." End Select Msg = Msg & Chr(13) & "Your Number: " & tmp Msg = Msg & Chr(13) & "Actual Number: " & Roll Msg = Msg & Chr(13) & Chr(13) & "Try again?" tmp = MsgBox(Msg, vbYesNo, Title) If tmp = vbNo Then Exit Do tmp = 0 Loop End Sub Function Dice() As Integer Randomize Dice = Int((6 * Rnd) + 1) End Function