Hey everybody. Error 13 (type mismatch) occurs when I try to run this macro.
Nevertheless, I can't find out which data types are incompatible. Could you help me to find it out, please?
Here is the code.
Nevertheless, I can't find out which data types are incompatible. Could you help me to find it out, please?
Here is the code.
Code:
Public Sub Macro1()
Dim m, n, p As Double
Dim x1, x2, xmin, z As Double
m = InputBox("Input m", "Input", "")
n = InputBox("Input n", "Input", "")
p = InputBox("Input p", "Input", "")
x1 = (m ^ 2 + n - Sqr(Abs(m * p))) / 10
If m > 10 And m < 15 Then
x2 = m + n
Else
x2 = p - m
End If
Dim usl As Boolean
usl = x2 > x1
If usl Then
x1 = xmin
Else
x2 = xmin
End If
z = xmin + 15
Dim answer As String
answer = "x1 = " & "x2 = " & "xmin = " And "z = "
MsgBox answer, "vbInforamtion", "Answer"
End Sub