Posted by **Matt** on Friday, June 28, 2013 at 1:19am.

How to get isnumeric function to display an "error" message when necessary.

Sub DetermineinterestSelectCase()

Dim loan As Variant

Dim interest As Double

loan = InputBox("Enter your desired loan amount, from 1 dollar to 5 million dollars.")

Select Case loan

Case IsNumeric(loan) = False: MsgBox ("Error")

Case Is < 1000000: interest = ".08"

Case 1000000 To 4000000: interest = ".10"

Case Is > 4000000: interest = ".11"

End Select

MsgBox ("The loan amount was " & loan & " with an interest rate of " & interest & "")

End Sub

Sub DetermineinterestIf()

Dim loan As Variant

Dim interest As Double

loan = InputBox("Enter your desired loan amount, from 1 dollar to 5 million dollars.")

IsNumeric (loan)

If loan < 1000000 Then interest = ".08"

If loan > 4000000 Then interest = ".11"

If 1000000 < loan < 4000000 Then interest = ".10"

MsgBox ("The loan amount was " & loan & " with an interest rate of " & interest & ".")

End Sub

- VBA programming -
**Steve**, Friday, June 28, 2013 at 5:59am
IsNumeric(s) returns true or false.

It's up to you to handle each case.

If IsNumeric(s) then

MsgBox(msg)

else

do other stuff

end if

- VBA programming -
**Steve**, Friday, June 28, 2013 at 5:59am
Oops - make that

If Not IsNumeric(s) Then

...

to handle the error case.

## Answer This Question

## Related Questions

- VBA Programming - I'm trying to create a macro that asks for a loan between 1 ...
- Computer Programming - I'm trying to create a vba code that solves this problem...
- Visual Basic - how to use formula b=p (1+r)^n, to calculate annual interests for...
- math - Loan #1 Year Amount owed 1 $3796 2 $3942 3 $4088 Loan # 2 Year Amount ...
- math - Loan #1 Year Amount owed 1 $3796 2 $3942 3 $4088 Loan # 2 Year Amount ...
- programming - write a program to calculate the amount of a server's tip given ...
- Vba - I'm trying to write a sub that asks how much oil I made, and then gives me...
- Math - What is the amount of interest on the loan? $ b. What is the maturity ...
- eco - Suppose a person pays $80 of annual interest on a loan that has a 5 ...
- Computer science - Write an HTML form that prompts the user to enter loan amount...

More Related Questions