Sub AreaOfTriangleBySides()
Dim SideA As Double, SideB As Double, SideC As Double, S As Double, Area As Double
SideA = Application.InputBox("What is side A?")
If SideA = False Then Exit Sub
If SideA <= 0 Then
MsgBox "The side of a triangle must be a positive number greater than 0."
Exit Sub
End If
SideB = Application.InputBox("What is side B?")
If SideB = False Then Exit Sub
If SideB <= 0 Then
MsgBox "The side of a triangle must be a positive number greater than 0."
Exit Sub
End If
SideC = Application.InputBox("What is side C?")
If SideC = False Then Exit Sub
If SideC <= 0 Then
MsgBox "The side of a triangle must be a positive number greater than 0."
Exit Sub
End If
S = (SideA + SideB + SideC) / 2
Area = Sqr((S - SideA) * (S - SideB) * (S - SideC))
MsgBox "The area of the triangle with sides " & SideA & _
", " & SideB & " and " & SideC & " is... " & Area
End Sub