I am creating a userform where the user will insert the short diamension , medium diamesion , and longest diamension of a box and the userform will tell if it is an elongated box , flat box or a standard box .

The criterias are as follows -

Flat package -
shortest diamension less than or equal to 8
AND medium diamension is four or more times larger than shortest diamension
AND the volume is equal to or more than 800

elongated package -
longest diamension is 36 or mre
AND both other diamensions are 20 percent or less of the longest diamension

If package qualifies as both flat and elongated , then following message showed show " Package qualifies as both elongated and flat. Test in accordance with elongated procedure ".

If neither are satisfied then its a standard package .

My code is as below .However, it only returns the msg as " it is elongated" .

thanks a lot for your help!




Sub test()
Dim longest As Single
longest = Me.TextBox1.Value
Dim medium As Single
medium = Me.TextBox2.Value
Dim shortest As Single
shortest = Me.TextBox3.Value




'elongated criteria


Dim half1 As Single
half1 = 0.2 * shortest
Dim half2 As Single
half2 = 0.2 * medium




'flat criteria
Dim short1 As Single
short1 = 4 * shortest
Dim volume As Single
volume = longest * shortest * medium






If longest >= 36 & shortest <= half1 & medium <= half2 & shortest <= 8 & medium >= short1 & volume >= 800 Then
MsgBox "Package qualifies as both elongated and flat. Test in accordance with elongated procedure"


ElseIf longest >= 36 & shortest <= half1 & medium <= half2 Then
MsgBox "it is elongated"


ElseIf shortest <= 8 & medium >= short1 & volume >= 800 Then
MsgBox "It is flat"
Else
MsgBox " it is standard"




End If


End Sub