0

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
braX
  • 11,506
  • 5
  • 20
  • 33
A.S
  • 9
  • 2
  • 2
    What do you intend to input in the `InputBox`? Please, show us an example and your expectations after processing. – FaneDuru Feb 06 '22 at 17:21
  • Do you want the user to enter 3 values, for x, y, and z? What has the `ActiveCell` to do with it? Please do clarify. – VBasic2008 Feb 06 '22 at 17:21
  • The code does not set `x`,`y`,`z` to anything. – Jonathan Barraone Feb 06 '22 at 17:29
  • The inputbox should ask for the side of the triangle and then it should tell the type of the triangle(based on the geometric characteristics) after inserting the 3 numbers of each side – A.S Feb 07 '22 at 18:13

0 Answers0