Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function calculate() As Integer
- Dim message As String, message2 As String
- Dim n1 As Byte
- Dim n2 As Byte
- Dim maximum As Integer
- maximum = 100
- message = "Please Enter a number 1:"
- message2 = "You have given bad input. Shame on you."
- n1 = InputBox(message)
- If n1 > maximum Then
- MsgBox (message2)
- Else
- n2 = InputBox(message)
- If n2 > maximum Then
- MsgBox (message2)
- Else
- solution = n1 + n2
- MsgBox ("" & solution & " = " & n1 & " + " & n2 & ".")
- End If
- End If
- End Function
- Sub test()
- Dim result As Integer
- result = calculate()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement