thank you for your help! however, something is wrong with the code i am using below to decide if type a ,type b or type c
type A = less than 50 lbs and girth equal to or less than 165. Girth is defined as length+2(width+height)
Type B =50 to less than 100 lbs and girth equal to or less than 165
type c = 100 lbs or greater and girth equal to or less than 165
l am gonna use the numbers such that i get type C. So lets say weight is 100 lbs , length is 100 , bread is 20 and height is 20 . So girth is 180. This should qualify for C type . However, on running the code , I get B type. What am i doing wrong?
thanks!
ub parceldelivery1()Dim weight As Double, lnth As Double, width As Double, height As Double, girth As Double Dim typea As Boolean, typeb As Boolean, typec As Boolean weight = Me.TextBox31.Value lnth = Me.TextBox32.Value width = Me.TextBox33.Value height = Me.TextBox34.Value girth = lnth + (2 * (width + height)) If (weight < 50) And (girth <= 165) Then typea = True Else typea = False End If If (50 <= weight < 100) And (girth <= 165) Then typeb = True Else typeb = False End If If (100 <= weight) And (girth <= 165) Then typec = True Else typec = False End If If typea Then Dim pdA As Range Set pdA = ActiveDocument.Bookmarks("t1").Range pdA.Text = "A" ElseIf typeb Then Dim pdb As Range Set pdb = ActiveDocument.Bookmarks("t1").Range pdb.Text = "B" Else If typec Then Dim pdc As Range Set pdc = ActiveDocument.Bookmarks("t1").Range pdc.Text = "C" End If End If End Sub




Reply With Quote