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

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

Oops - make that

If Not IsNumeric(s) Then
...

to handle the error case.

To display an "error" message when necessary using the IsNumeric function, you can modify the code as follows:

Sub DetermineinterestSelectCase()
Dim loan As Variant
Dim interest As Double
loan = InputBox("Enter your desired loan amount, from 1 dollar to 5 million dollars.")

If Not IsNumeric(loan) Then
MsgBox ("Error: Please enter a valid loan amount.")
Exit Sub
End If

Select Case CDbl(loan)
Case Is < 1000000: interest = 0.08
Case 1000000 To 4000000: interest = 0.10
Case Is > 4000000: interest = 0.11
End Select

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

In this modified code:
1. We added an If statement before the Select Case block to check if the loan variable is numeric using the IsNumeric function.
2. If the loan variable is not numeric, a MsgBox is displayed with an "Error" message.
3. We used the CDbl function to convert the loan variable to a Double in the Select Case statement to compare the numeric values.
4. We removed the quotation marks from the interest rates to ensure they are treated as numeric values.

This updated code will display an "Error" message when the user enters a non-numeric value in the loan input box.