Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Carolina Lopez   on Sep 20 In MS Office Category.

  
Question Answered By: Blaze Fischer   on Sep 20

I found way to fix the code  using the 'IsNumeric' command. I modified
the code as follows and it's working without the type mismatch error.
(I'll just modify  again to use do while loop as suggested by Neville).

Dim val1 As String

val1 = InputBox("Enter any number  between 700 to 800")
val2 = IsNumeric(val1)

If val1 = "" Then
MsgBox "No data entered."

ElseIf val2 = False Then
MsgBox "Wrong data"

ElseIf val2 = True Then
If val1 >= 700 And val1 <= 800 Then
MsgBox "OK"
Else
MsgBox "Wrong"
End If

End If

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Error in InputBox Or get search suggestion and latest updates.


Tagged: