kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Code:
Option Explicit
Sub AreaOfTriangle ()
Dim a As Long, b As Long , Aunit As Variant
On Error resume Next
a = Application.InputBox ("Enter base of triangle" , Type:=1)
b = Application.InputBox ("Enter height of triangle" , Type:=1)
Aunit = Application.InputBox ("Enter unit of measurement " , Type:=1)
MsgBox "The area of the triangle is: " & 0.5*a*b & Aunit, vbInformation, "Area of a triangle "
On Error GoTo 0
End Sub
I get number is not valid for the last input. Which is the unit.
What am I doing wrongly?