lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I want to improve the code below. If user will enter a text instead of number the program will not stop because of "type miss match" message but maybe give a warning message to user or something. How can I do that? Thank you so much.
I want to improve the code below. If user will enter a text instead of number the program will not stop because of "type miss match" message but maybe give a warning message to user or something. How can I do that? Thank you so much.
Code:
Sub studentmarks()
'to find students grade
Dim x As Integer
Dim z As Integer
For z = 1 To 5
x = InputBox("number")
If x > 90 Then
MsgBox "a"
ElseIf x > 70 Then
MsgBox "b"
Else
MsgBox "f"
End If
Next z
End Sub