The goal of the VBA is to identify what the CUBIC INCHES that a group of styles(items) can fit into to ship to a customer. You will notice that in the table the carton # is repeated. Styles are assigned to a carton.
The only thing I am looking for is the minmum cube of the box. The length dimension is always the largest length of any one style within the carton.
Please refer to the example below.
Carton Style Length Width Height
1000 7418 12 7 3
1000 5296 6 8 3
1000 3741 5 3 2
Step 1) Find the longest legnth dimension
Dimension 1= 12
Step 2) Find the widest width dimension
Dimension 2= 8
Step 3) If the sum of any two length dimensions is less than the longest length dimension then set the shorter in height of the items to zero
6+5 is less than 12 set shorter on to zero
Style 3741 hieght is 2(less than 5296) set to zero
Carton Style Length Width Height
1000 7418 12 7 3
1000 5296 6 8 3
1000 3741 5 3 0
Step 4) If the sum of any two width dimensions is less than the widest width dimension then set the shorter in height of the items to zero
I 7+3 is longer than 8; end if
Step 5) Sum the height of all styles to determine height dimension
RESULTS
IM 1 12
Dim 2 8
DIM 3 6
Step 6: Set the "Carton length" to largest DIM
Set the "Carton width" to the second larggest dimesnion
Set the "carton highet" as the smalles t dimension
Multiple each dim toghether and set as CUBE.
Carton Legnth Height Width Cube
1000 12 8 6 576