I am trying to create a macro that asks the user the side of a triangle and that displays its properties. We may control the validity of the parameters, displaying the error messages when needed.
I wrote the following code, but it does not seem to be working:
Sub SideTriangle()
Dim x As Double
Dim y As Double
Dim z As Double
ActiveCell = InputBox("Enter side of triangle")
If x = y And y = z And z = x Then
MsgBox "Equilateral"
ElseIf x = y Or y = z Or z = x Then
MsgBox "Isosceles"
Else
If x <> y And x <> z And y <> z Then
MsgBox "Scalene"
ElseIf f(x * x) + (y * y) = (z * z) Or (y * y) + (z * z) = (x * x) Or (x * x) + (z * z) = (y * y) Then
RectangleTriangle "Rectangle triangle"
Else: MsgBox "Error"
End If
End If
End Sub